Created
April 27, 2015 13:01
-
-
Save tsvetomir/4fc4497621c0cc023958 to your computer and use it in GitHub Desktop.
PRNG - Linear feedback shift register
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var random = (function() { | |
// Implements 32-bit Linear feedback shift register | |
var lfsr = 0xDEADBEEF; | |
return function() { | |
lfsr = ((lfsr >>> 1) ^ (-(lfsr & 1) & 0xD0000001)) >>> 0; | |
return lfsr; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment