2

Is it possible to generate random numbers through physical process simulation?

If I simulate the physical roll of a dice (i.e. you picking it up, shaking it in your hand, releasing it onto the table and recording which side ends up "up"...) will that produce a "random" number or would I just have a complex simulation which really accomplishes nothing.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
user72491
  • 3,527
  • 5
  • 24
  • 18

8 Answers8

6

You would have a complex simulation which really accomplishes nothing.

(other than to return the same value every time, or add unnecessary complexity to an existing PRNG)

Unless you seed the simulated environment with "random" variables (i.e. depend on a different means of generating random numbers), you will always get the same value back, because every step in the process will happen the same way every time.

Say you did use a base pseudo random number generator (PRNG):

Since your simulation would only be as random as the other PRNG you were using, you may as well just use the other PRNG directly, without all the extra work! (In fact, your simulation may not do anything except make the output less random than the values from your base PRNG)

Daniel LeCheminant
  • 50,583
  • 16
  • 120
  • 115
1

It'll still be a pseudo-random number because presumably you'll be using a pseudo-random number generator to simulate all the bouncing around of the die in your hands.

Dana
  • 32,083
  • 17
  • 62
  • 73
1

Yes, you would "just have a complex simulation which really accomplishes nothing".

Why simulate a random physical process, when you could actually use a real one?

There are stacks of questions about random number generators on SO. Here are just a few:

True random number generator

Do stateless random number generators exist?

What Type of Random Number Generator is Used in the Casino Gaming Industry?

Community
  • 1
  • 1
Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
1

Your algorithm will be a pseudo-random number generator, that is to say it will take in a random seed and produce potentially large number strings which look fairly random.

There is no guarantee however that your random output will be of the quality that you need for cryptography or other purposes. I'd be inclined to think that there will be undesirable repeated patterns in your output, and that too much work will go towards the physics of the problem, and not enough to producing pseudo randomness. (Sorry for the wishy washiness, but that's it in a nutshell.) There exist effective pseudo number generators, and I would use one of the shelf.

That said, this might be an interesting and informative experiment for your own purposes.

Rob Lachlan
  • 14,289
  • 5
  • 49
  • 99
1

I beg to disagree with the general response.

If you add an (i) "energy" component that simulates at what force you "throw" the dice, (ii) a 'torque' component that simulates how the dice 'rotates', and (iii) a 'retardation' component that simulates the 'friction' between the dice and the table, then you should be able to model the process comprehensively.

The process is not entirely random in reality though, if you throw the dice with the same force and spin then you're bound to get the same face up. Assuming the shape/size of the dice does not change and friction at the table remains constant, the process of simulating "throwing of a dice" can be done.

The caveat - you need a random number generator to select random values of "energy", "torque", "friction" that you input to your simulation model, otherwise you'll repeat the previous pattern. But this is not a limitation of the simulation model described, the initial condition is rather flawed - the process of throwing a dice is not totally random and therefore won't give you a 'random number'. If you maintain the same "force", "spin" and "friction", you'll always end up with the same side facing up.

0

The later.

Unless you inject some random (or pseudo random) factors the simulation will produce the same results every time.

MarkusQ
  • 21,814
  • 3
  • 56
  • 68
0

First you need to define 'random'. You can generate trivially unpredictable numbers by using a strange set of calculations, sure. But you won't get useful randomness or an even distribution of numbers.

A physical simulation like you describe would actually require some sort of random number generator at some point in the calculation. Fortunately, random() is easy to use.

John Fricker
  • 3,304
  • 21
  • 21
0

Unless you're prepared to model the quantum state of two entire dies you'll have nothing random...

Dave Swersky
  • 34,502
  • 9
  • 78
  • 118