Originally Posted by
Darkhog
So why following program
...
gives me this output:
16
2
16
29
There's only 1 explanation that comes to mind, that normal Random() uses other internal variables for the result, not just seed.
I also changed the second function result to cardinal, only the first one was designed to return double. See that it uses Trunc in it, then you used it second time afterwards, which i didn't intend. But this doesn't change the outcome, such thing would seem to need a custom made random algorithm.
edit: No, it's just seed but it can advance the randseed one or 2 times on one call
Code:
random := int64((qword(cardinal(genrand_MT19937)) or ((qword(cardinal(genrand_MT19937)) shl 32))) and $7fffffffffffffff);
genrand_MT19937()-function is used twice in the sentence there. Seems to be well over 99.999% chance for it to call it twice, because chances for first genrand returning 0 is slim.
Bookmarks