Random Number Generator visual analysis

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Random Number Generator visual analysis

Benoit St-Jean
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'.

--
You received this message because you are subscribed to the Google Groups "PolyMath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/polymath-project/87c5118f-1a63-4c81-9064-ba86143f53a4%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Random Number Generator visual analysis

SergeStinckwich


On Thu, Feb 6, 2020 at 4:46 AM 'bstjean' via PolyMath <[hidden email]> wrote:
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'.

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

--
You received this message because you are subscribed to the Google Groups "PolyMath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/polymath-project/CAOysuxVpLPURSXGhwd6YW5h97dJNG%2B3htS9VLrh6OWo3mZW4uw%40mail.gmail.com.