10
$\begingroup$

So, a fair die throw is really random, not pseudo. So, would a RNG implemented as the result of a die throw in a physics engine (say, Newton, Havok, Nvidia's PhysX) be regarded as both cryptographically secure and really random (Not a PRNG, but a real RNG)?

$\endgroup$
5
  • 5
    $\begingroup$ Should depend on where the physics engine gets the randomness it uses internally. $\endgroup$
    – mikeazo
    Commented Nov 5, 2014 at 1:30
  • 2
    $\begingroup$ "dice" is the plural of "die". Just thought you might like to know. :) $\endgroup$
    – Almo
    Commented Nov 5, 2014 at 21:43
  • $\begingroup$ @Almo oh damn (English is not my first language). I thought it was just a jerk defacing the post, I'll fix it. $\endgroup$
    – ppp
    Commented Nov 5, 2014 at 21:47
  • $\begingroup$ No problem! Many native English speakers get this wrong too. :) $\endgroup$
    – Almo
    Commented Nov 5, 2014 at 21:57
  • $\begingroup$ And "physics engine" is what? $\endgroup$ Commented Feb 9, 2022 at 18:42

3 Answers 3

14
$\begingroup$

No, that would not be a true RNG, because these physics engines would just repeat the exact same calculation and thus repeat the whole sequence of random numbers - like a PRNG. The starting conditions are the seed of this PRNG.

Dice are truly random in the real world. Well, are they? If we ignore quantum effects, we could measure all relevant values of the environment and then calculate the next value of the die - at least in theory. In practice the calculations are much too difficult, and the quantum effects destroy even the theoretical possibility to calculate the result.

The physics engines mostly calculate only the important parts of the calculation: the collision with other objects and the gravity. But in the real world, we got air movement (wind, breathing of a human), fluctuation in the temperature, very small movement of the earth, difference in the gravitational field of Earth, or even the vibrations of the heart, wear and tear of the dice or just contamination in the material.

Even if the engine could calculate all this in an acceptable time period, it would have to introduce a RNG itself to simulate the quantum effects. If the engine does this (like mentioned by mikeazo in a comment), then why use the engine and not the RNG directly? If the output of the engine is bigger than the input from the intern RNG, it can't be a true random number generator anymore. It would have to stretch the random numbers. Maybe it's still secure, but using AES in CTR mode would do the same with surely much better properties.

Fun fact: There's the Dice-o-matic which again and again rolls many dice to determine random numbers. It's used to get random numbers for an online game platform. Well, that could be the closest you will come to get true random numbers from a machine with dice.

$\endgroup$
9
  • $\begingroup$ Dices are truly random in the real world, but are not fair, and that's a fact accessible to experience (with patience or a simple robot + computer vision). It is not hopeless to show that the holes traditionally made in an otherwise symmetrical dice to mark the values create an imbalance with a practical effect, IMHO making 1 slightly more likely than 6 (a physics engine could help show that, turning the question around). $\endgroup$
    – fgrieu
    Commented Nov 5, 2014 at 6:43
  • 1
    $\begingroup$ @fgrieu: That's mostly right, but then again there are dice which try to solve this Problem with bigger holes for the 1 as example. $\endgroup$
    – Nova
    Commented Nov 5, 2014 at 8:47
  • 2
    $\begingroup$ @fgrieu Dice are not truly random. They seem that way, but that's only because the physics is complex. But (ignoring quantum effects), if the model and ability to measure the input parameters of a roll was sufficiently accurate, the rolls of actual dice would be 100% predictable because they're entirely based on physics. $\endgroup$
    – Beska
    Commented Nov 5, 2014 at 13:58
  • $\begingroup$ @Beska, given that view, is there any such thing as truly random? $\endgroup$
    – mikeazo
    Commented Nov 5, 2014 at 14:39
  • $\begingroup$ @mikeazo Excluding quantum effects? No. That said, in real situations the physics are often complex enough or the input so difficult to measure that there is no appreciable difference. We can see from chaotic systems that small differences in input can make large differences in output over time, so when our ability to measure is inexact and the output is far enough away from the source, even though it isn't random, it is (currently) unpredictable. (This may be an argument of semantics more than anything else.) $\endgroup$
    – Beska
    Commented Nov 5, 2014 at 14:49
5
$\begingroup$

Any result of a dice-throwing simulation in a physics engine is determined by its initial state prior to starting the simulation. Accordingly, the same initial state will always result in the same die surface coming up.

To obtain a quantity of $N_{output}$ random output bits of randomness quality $Q_{output}$ from this simulation would require seeding with $N_{input}$ bits of random input data (to construct the initial state) of quality $Q_{input}$; where the following two approximate rules of thumb can be inferred: $Q_{input} \approx Q_{output} \Rightarrow N_{input} \gtrapprox N_{output}$ and $N_{input} \approx N_{output} \Rightarrow Q_{input} \gtrapprox Q_{output}$. That is to say, the physics simulation functions as a (very poor) pseudo-random number generator.

$\endgroup$
1
  • $\begingroup$ $^{\color{green}{+1}}$ $\endgroup$
    – e-sushi
    Commented Nov 6, 2014 at 6:18
3
$\begingroup$

Who says that a dice roll is truly random?

I notice you define it as a "fair" dice roll; sure, a "fair" real-world dice roll could be considered random but its randomness is based up our inability to manipulate the dice precisely (haha) while shaking them in our hand and then throwing them onto a surface. If we were in complete control of the initial state of the throw, meaning the velocity and starting position of each die and we were conversant with the environmental properties (air, table surface, hell, humidity) enough to be able to compensate for them in our throw, it would be an easy thing to roll whatever roll you would like. However, a dice roll, for us, is random because we can apply something non-random like the movement of our hands as we shake the dice inside them such that their initial state cannot be known at the moment they are thrown and so we get some random values. Our perception and control are too large to be able to see and affect things so precisely. It is actually the movement of the dice inside our cupped hands as we shake them that is the randomizing factor here…

Hypothetically, if we had precise enough instruments and knowledge of our environment we could predict the outcome of any dice roll the instant AFTER the dice are released. It is like this in a simulation, where one is in full control as one has defined all the factors. Given the same initial state, repeated simulations will always return the same result. Meaning, in this case, that the physics engine is accurate enough that, unlike the real world, simply giving them a trajectory and allowing their interaction with the environment to do the rest is not enough to be random. In a physics simulation of a dice roll, one has likely modelled the surface the dice are to be thrown on, the dice themselves, perhaps the air/pressure and gravity. What one does not normally model, are the hands (or cup) which the dice are shaken around in before they are thrown. The beauty of modelling the hands (or a cup) is that one could conceivably apply any non-random pattern of movement (such as an oscillation for shaking them up and down) coupled with a non-random point in time in the future in which the dice are released to essentially randomize the initial states of the dice.

Did that make sense? If not, let me sum it up.

No, a physics simulation of dice rolling would not be random, however a physics simulation of dice being shaken in a cup where the shaking movement can be whatever- arbitrary, or following a pattern, so long as it changes vectors a few times, and the point of release can be any time in the future, after perhaps 2 vector changes of the movement of the cup.

Oh, with a cup one could oscillate its movement along one or two axis and also oscillate the cup's rotation. That would probably do it. If not, it would be a simple thing to add some other non-random variation that the end result would be random.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.