flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Simple Pseudo Random Number Generator |
Author |
|
Mike Gonta 17 Feb 2017, 22:03
Here is a simple real mode (80386 code) PRNG with a period of (2^64)-1.
It's an optimized implementation (only 4 instructions) of the Galois LFSR PRNG. There's an LCG in simple_prng_init to process the entropy. I'm using it in Space Invaders Code: shr edx, 1 rcr eax, 1 jnc .1 xor edx, 0xD0000000 ; 0xD000000000000000 is maximal tap for 64 bit .1: simple_prng.asm |
|||
17 Feb 2017, 22:03 |
|
nkeck72 21 Feb 2017, 22:23
Nice. I might use this in another project of mine if I get the chance.
|
|||
21 Feb 2017, 22:23 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.