Monte Carlo estimation of PI


Author Message
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5991
Posted: 09:01am 10 Sep 2020      

GerryL's algorythm uses floats (not pixels).
So in theory it should (give sufficient time) reach infinite resolution.

It is the randomizer I am worried about. Typically these are build up around 16bit shift registers (or 32 bit). Meaning that whatever scaling you apply, there are only so many different values possible. Even with a good distribution (all values have equal chance), there are only so amny.

It should be easy to check if that is the case. In stead of rando numbers, use for-next loops for both x and y with significant resolution.

example: x = 0 to 1 step 0.000001

And see where you end up ...