Random Number Generator visual analysis

14 views
Skip to first unread message

bstjean

unread,
Feb 5, 2020, 10:46:22 PM2/5/20
to PolyMath
Don't know if that of any use to be on PolyMath but I found that quick & dirty way of rapidly detecting if a RNG suffers from big problems.  Can be useful if, with a single glance, you can avoid running a gazillion statistical tests for nothing since the RNG is obviously broken.  Just try the following code in a workspace :

"References:
https://www.random.org/analysis/
https://boallen.com/random-numbers.html
"
| form colors yourFavoriteRNG size |

size := 512.
yourFavoriteRNG := Random new.

colors := Array with: Color white with: Color black.
form := Form extent: size@size depth: 32.

0 to: (size-1) do: [ :x |
    0 to: (size-1) do: [ :y | form colorAt: (x@y) put: (colors atRandom: yourFavoriteRNG) ] ].
PNGReadWriter putForm: form onFileNamed: 'test.png'.

Serge Stinckwich

unread,
Feb 6, 2020, 8:41:32 AM2/6/20
to polymath...@googlegroups.com
Maybe you can add this as a method visualAnalysis in PM in order to obtain a form from any RNG?

thank you for your contribution.
A+
--
Serge Stinckwic
h

Int. Research Unit
 on Modelling/Simulation of Complex Systems (UMMISCO)
Sorbonne University
 (SU)
French National Research Institute for Sustainable Development (IRD)
U
niversity of Yaoundé I, Cameroon
"Programs must be written for people to read, and only incidentally for machines to execute."
https://twitter.com/SergeStinckwich
Reply all
Reply to author
Forward
0 new messages