Wow, is this very fascinating.

However, this formula seems to be not always correct: For example, if I store 999999 to rand, and then run your formula, it returns: 0,9973539356

But when I use the OS rand, it returns: 0,0268627267 :/

Even for most numbers the formula only seems to be nearly correct: After some digits they differ:

For example: 1 -> rand

Then the formula returns:

(1)
\begin{align} \color{Green}{0,7455607}\color{Red}{429} \end{align}

But the OS rand returns:

(2)
\begin{align} \color{Blue}{0,7455607728} \end{align}

So the last three digits are incorrect here?

Why is this? Is the formula only partially true or does the OS treat numbers in a slightly different way than Basic?

I still find this kind of interesting and fascinating though, how random numbers are **calculated** and how you can predict them.

By the way, is the formula for further [[rand]] calls known? You only can foresee the first rand call with this formula ;)

When I remember correctly, it has something to do with a linear equation which is the first operand of the modular operation and a prime number or something (or it was a 2^x number) being the second operand and then it gets counted from 1 to n, and due to a factor and the modular operantor it somehow gets pseudo-random numbers.

I remember Xeda Elnara explaining this once with a huge post :)

Oh, if it matters, the program that I used for testing the formula, was:

```
:Input “Rand seed=“,A
:A->Rand
:Disp “Calc:
:Disp “fPart(1-min(ΔList(fPart(A{40014^2,40692}/2^31-{85,249 //your formula
:Disp “rand:
:Disp rand
```