- Notifications
You must be signed in to change notification settings - Fork0
JavaScript implementation of the XORSHIFT-ADD (XSadd) pseudo random number generator
License
NotificationsYou must be signed in to change notification settings
mljs/xsadd
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
JavaScript implementation of the XORSHIFT-ADD (XSadd) pseudo random number generator.
Based on the C code fromhttps://github.com/MersenneTwister-Lab/XSadd.
$ npm install ml-xsadd
const{ XSadd}=require("ml-xsadd");constgen=newXSadd();constnumber=gen.getFloat();
Creates a new XSadd instance. Seed is an optional integer that defaults toDate.now()
.
Returns a 32-bit integer r (0 <= r < 2^32).
Returns a floating point number r (0.0 <= r < 1.0).
LikegetFloat()
but dynamically bound to theXSadd
instance.
You can use this function externally, likeMath.random
:
constxsadd=newXSadd();constrandom=xsadd.random;constnumber=random();
Reinitialize the generator with a new seed.
About
JavaScript implementation of the XORSHIFT-ADD (XSadd) pseudo random number generator
Resources
License
Stars
Watchers
Forks
Packages0
No packages published