Skip to content

Fast, simple, quality random numbers on an 8 bit microcontroller.

License

Notifications You must be signed in to change notification settings

edrosten/8bit_rng

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple random number generator based on the xorshift algorithm.

http://en.wikipedia.org/wiki/Xorshift

The RNG is 8 bit and suitable for very efficient implementation in assembly
language on very small microcontrollers.

The files are named after the period of the longest cycle.

rng-4294967294 has an almost optimal cycle so no real care is required
for seeding except avoiding all zeros, but it fails many of the die hard
random number tests.

rng-4261412736 has a 0.8% chance of falling into a poor quality short chain,
a some degree of care is required to seed it. However, the quality of the 
random numbers is excellent for such a small state (32 bits), and it passes
almost all of the die hard tests.

rng-4261412736.asm is an implementation in assembly which has been used on a
PIC12F675 MCU, which lacks hardware multiply, divide and even barrel shift.

About

Fast, simple, quality random numbers on an 8 bit microcontroller.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published