Simple Random Number Generator
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
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
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
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?
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: Simple Random Number Generator
This happensLove4Boobies 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?
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum
Compiler Development Forum
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Simple Random Number Generator
I don't see the relevance of that story.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: Simple Random Number Generator
Somebody got their calculator out (because of the insecure PRNG) and predicted the winning numbers of a gambling game.Love4Boobies wrote:I don't see the relevance of that story.
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum
Compiler Development Forum
Re: Simple Random Number Generator
+1 more story, more RNG hardcore: https://www.wired.com/2017/02/russians- ... os-no-fix/matt11235 wrote:This happensLove4Boobies 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?
Re: Simple Random Number Generator
Good suggestion.Love4Boobies wrote:I don't understand why you didn't just settle for a LCG or a LFSR.
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: Select all
shr edx, 1
rcr eax, 1
jnc .1
xor edx, 0xD0000000 ; 0xD000000000000000 is maximal tap for 64 bit
.1:
Obvious here, but maybe not so further up the ivory tower.dozniak wrote:It's a PRNG, not an RNG, right?
simple_prng.asm
- dchapiesky
- Member
- Posts: 204
- Joined: Sun Dec 25, 2016 1:54 am
- Libera.chat IRC: dchapiesky
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...
http://simul.iro.umontreal.ca/testu01/tu01.html
should be easy to add as another prng in the testkit...
Plagiarize. Plagiarize. Let not one line escape thine eyes...
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.
Operating system for SUBLEQ cpu architecture:
http://users.atw.hu/gerigeri/DawnOS/download.html
http://users.atw.hu/gerigeri/DawnOS/download.html
Re: Simple Random Number Generator
I'm quite curious as to what you do to the time to offend the profanity filter.
Learn to read.
Re: Simple Random Number Generator
https://i.ytimg.com/vi/fvf_gwQCcUg/maxresdefault.jpgdozniak wrote:I'm quite curious as to what you do to the time to offend the profanity filter.
Operating system for SUBLEQ cpu architecture:
http://users.atw.hu/gerigeri/DawnOS/download.html
http://users.atw.hu/gerigeri/DawnOS/download.html