OSDev.org https://forum.osdev.org/ |
|
Simple Random Number Generator https://forum.osdev.org/viewtopic.php?f=2&t=31370 |
Page 1 of 1 |
Author: | mikegonta [ Wed Feb 15, 2017 4:18 pm ] |
Post subject: | Simple Random Number Generator |
Simple Random Number Generator Here is a simple 16 bit real mode (8086 code) RNG. It's an implementation of the KISS RNG I'm using it in Space Invaders The simple_rng_init uses 2 of the 3 RNG's used in simple_rng to generate the 4 seeds and then calls simple_rng to get the first number in the series which is saved for later. simple_rng compares each generated number and when the series repeats calls simple_rng_init to begin a new series. Obviously with only a 64 bit seed the period will be short but none the less suitable for small systems. simple_rng.asm |
Author: | dozniak [ Thu Feb 16, 2017 9:15 am ] |
Post subject: | Re: Simple Random Number Generator |
It's a PRNG, not an RNG, right? |
Author: | Love4Boobies [ Thu Feb 16, 2017 10:11 am ] |
Post subject: | Re: Simple Random Number Generator |
I don't understand why you didn't just settle for a LCG or a LFSR. Are you afraid that people will pause the game, pull out their calculators, and try to predict the events in the game? |
Author: | matt11235 [ Thu Feb 16, 2017 10:19 am ] |
Post subject: | Re: Simple Random Number Generator |
Love4Boobies wrote: I don't understand why you didn't just settle for a LCG or a LFSR. Are you afraid that people will pause the game, pull out their calculators, and try to predict the events in the game? This happens
|
Author: | Love4Boobies [ Thu Feb 16, 2017 10:47 am ] |
Post subject: | Re: Simple Random Number Generator |
I don't see the relevance of that story. |
Author: | matt11235 [ Thu Feb 16, 2017 11:01 am ] |
Post subject: | Re: Simple Random Number Generator |
Love4Boobies wrote: I don't see the relevance of that story. Somebody got their calculator out (because of the insecure PRNG) and predicted the winning numbers of a gambling game.
|
Author: | Nable [ Thu Feb 16, 2017 3:33 pm ] |
Post subject: | Re: Simple Random Number Generator |
matt11235 wrote: Love4Boobies wrote: I don't understand why you didn't just settle for a LCG or a LFSR. Are you afraid that people will pause the game, pull out their calculators, and try to predict the events in the game? This happens |
Author: | mikegonta [ Fri Feb 17, 2017 2:45 pm ] |
Post subject: | Re: Simple Random Number Generator |
Love4Boobies wrote: I don't understand why you didn't just settle for a LCG or a LFSR. Good suggestion.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: dozniak wrote: It's a PRNG, not an RNG, right? Obvious here, but maybe not so further up the ivory tower.simple_prng.asm |
Author: | dchapiesky [ Fri Feb 17, 2017 7:56 pm ] |
Post subject: | Re: Simple Random Number Generator |
Perhaps said PRNG could be run through the gauntlet? http://simul.iro.umontreal.ca/testu01/tu01.html should be easy to add as another prng in the testkit... |
Author: | Geri [ Wed Mar 15, 2017 12:38 pm ] |
Post subject: | Re: Simple Random Number Generator |
in the Dawn operating system, i **** the time, shuffle it with previous results, add pixels from screen, and mouse position. |
Author: | dozniak [ Wed Mar 15, 2017 1:45 pm ] |
Post subject: | Re: Simple Random Number Generator |
I'm quite curious as to what you do to the time to offend the profanity filter. |
Author: | Geri [ Fri Mar 17, 2017 2:53 pm ] |
Post subject: | Re: Simple Random Number Generator |
dozniak wrote: I'm quite curious as to what you do to the time to offend the profanity filter. https://i.ytimg.com/vi/fvf_gwQCcUg/maxresdefault.jpg |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |