2 Replies - 162 Views - Last Post: 27 February 2019 - 01:43 PM Rate Topic: -----

#1 kroban   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-February 19

Math behind "random" numbers

Posted 27 February 2019 - 11:09 AM

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.

Is This A Good Question/Topic? 0
  • +

Replies To: Math behind "random" numbers

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14925
  • View blog
  • Posts: 59,592
  • Joined: 12-June 08

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.
Was This Post Helpful? 0
  • +
  • -

#3 jon.kiparsky   User is offline

  • Beginner
  • member icon


Reputation: 11458
  • View blog
  • Posts: 19,524
  • Joined: 19-March 11

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1