|
Post by scalion on Sept 2, 2018 20:28:19 GMT 1
In some cases it is useful to have a total control over the pseudorandom values used for example to create a terrain or a sudoku grid. I present my method here which gives a good result: FullW 1 : Void SetForegroundWindow(Me.hWnd) : AutoRedraw = 1 Do Plot MyRnd * _X, MyRnd * _Y PeekEvent Loop Until Me Is Nothing Function MyRnd Static Double r1 = 0.1, r2 = 0.2, r3 = 0.3, r4 = 0.4 r1 = Frac(r1 / 2 + r2 * 4) r2 = Frac(r2 / 2 + r3 * 3) r3 = Frac(r3 / 2 + r4 * 2) r4 = Frac(r4 / 2 + r1) Return Frac(r1) EndFunc
Have fun !
|
|