"pick random" investigations

See inside
Notes and Credits

Was curious about certain aspects of "pick random", so I put this together to investigate, and thought I'd share the results - some of you may be vaguely interested... :)

I'm also curious to know if it might be different on other OSes.

Anyway, here's what I see on my MacBook:

It can only go up to ~2^31 (and down to similar negative) before it starts giving real values instead of integers.

It only has a precision of one part in 2^31, even for real values, which suggests it is built on top of some OS PRNG that picks integers in range 0 to 2^31(-1?), and then operates on that to give a value in the requested range (as well as turning it into a real value by dividing by the range).

Above also means you can predict decimal part of rand2,4,6,7&10 from its integer part (eg: take int part of rand2 and divide by 2^31).

Shared: 30 Jan 2016 Modified: 30 Jan 2016
Favorite this project 19
Love this project 34
Total views 571
View the remix tree  1
More projects by TheLogFather