Hello first time posting a question in this forum.I have a question.There is a grogram that has as input some numbers,does some math with them which i dont know and it generates 20 "random" numbers from 1 to 80.Is there possible way to create a project that i feed it with the inputs and the result nubmers and get the math behind it or the next result ?The inputs are always different values so the result numbers are different everytime.I dont even know if python is suitable for this maybe an other language?Its for a final project in school.Any help is apriciated thanks in advance.

# Math behind "random" numbers

Page 1 of 1## 2 Replies - 162 Views - Last Post: 27 February 2019 - 01:43 PM

##
**Replies To:** Math behind "random" numbers

### #2

## Re: Math behind "random" numbers

Posted 27 February 2019 - 11:52 AM

I imagine you can feed it numbers, get the outputs, and see about devising the math in the black box. Sure.. python would be ok... so would c#, vb.net, c++, perl, ruby, etc.

### #3

## Re: Math behind "random" numbers

Posted 27 February 2019 - 01:43 PM

Random number generators are an interesting area of code. Technically we're talking about a "pseudo-random number generator". "Pseudo" because they're actually deterministic, but they still pass the standard suite of tests for randomness. Which again, is an interesting notion!

I won't go into the details right now because (1) I'm at work and (2) you can look them up, but essentially if you have a working PRNG, you have a piece of code which promises that, given some sequence of generated numbers (n1, n2, n3, .... ni) you cannot predict anything about the successors of that sequence (ni+1, ni+2, ... ni+j). (To be more precise, you would replace "number" with "bit" - think of a PRNG as a source of bits, which are either 1 or 0 - obviously, you can go from there to numbers easily).

If I give you some sequence of numbers, and I tell you that it's from a PRNG, you should expect that you will not be able to do any better than chance if you try to predict the numbers that follow. Nor indeed should you do any worse than chance!

So if the numbers are meant to be random, as in generated by python's random module, then any success on your part would be a big embarrassment for python. And also very surprising. (like, so surprising that you should bet lots and lots of money that you're going to fail at this, and you should expect that nobody who knows what they're talking about will take that bet at any odds)

If you mean "random" as in "generated by some function that you don't get to see ahead of time, but isn't actually meant to be random", then yes, you should be able to analyze a deterministic function and learn something about it, and python is a reasonable language for this.

I won't go into the details right now because (1) I'm at work and (2) you can look them up, but essentially if you have a working PRNG, you have a piece of code which promises that, given some sequence of generated numbers (n1, n2, n3, .... ni) you cannot predict anything about the successors of that sequence (ni+1, ni+2, ... ni+j). (To be more precise, you would replace "number" with "bit" - think of a PRNG as a source of bits, which are either 1 or 0 - obviously, you can go from there to numbers easily).

If I give you some sequence of numbers, and I tell you that it's from a PRNG, you should expect that you will not be able to do any better than chance if you try to predict the numbers that follow. Nor indeed should you do any worse than chance!

So if the numbers are meant to be random, as in generated by python's random module, then any success on your part would be a big embarrassment for python. And also very surprising. (like, so surprising that you should bet lots and lots of money that you're going to fail at this, and you should expect that nobody who knows what they're talking about will take that bet at any odds)

If you mean "random" as in "generated by some function that you don't get to see ahead of time, but isn't actually meant to be random", then yes, you should be able to analyze a deterministic function and learn something about it, and python is a reasonable language for this.

Page 1 of 1