Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Simple Pseudo Random Number Generator

7 views
Skip to first unread message

Noah Keck

unread,
Feb 25, 2018, 2:34:46 PM2/25/18
to
Where should I take the output from the generator from, EAX or EDX? Or does
it matter?

"Mike Gonta" <mike...@gmail.com> wrote in message
news:o8832i$13f$2...@gioia.aioe.org...
> "Mike Gonta" wrote:
> > Simple Pseudo Random Number Generator
> > Here is a simple real mode (80386 code) PRNG with a period of (2^64)-1.
>
> And this one is even better.
> It's an optimized implementation (only 4 instructions) of the Galois LFSR
> PRNG.
> I'm using it in Space Invaders:
> http://mikegonta.com/Space_Invaders
>
> [code]
> shr edx, 1
> rcr eax, 1
> jnc .1
> xor edx, 0xD0000000 ; 0xD000000000000000 is maximal tap for 64 bit
> .1:
> [/code]
>
> The complete code is here:
> http://mikegonta.com/Space_Invaders/blob/master/include/simple_prng.asm
>
>
> Mike Gonta
> look and see - many look but few see
>
> http://mikegonta.com
>
>


0 new messages