Socket
Socket
Sign inDemoInstall

ml-xsadd

Package Overview
Dependencies
0
Maintainers
5
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ml-xsadd

JavaScript implementation of the XORSHIFT-ADD (XSadd) pseudo random number generator


Version published
Weekly downloads
51K
increased by76.85%
Maintainers
5
Install size
9.63 kB
Created
Weekly downloads
 

Readme

Source

xsadd

NPM version build status npm download

JavaScript implementation of the XORSHIFT-ADD (XSadd) pseudo random number generator.

Based on the C code from https://github.com/MersenneTwister-Lab/XSadd.

Installation

$ npm install ml-xsadd

API

new XSadd([seed])

Creates a new XSadd instance. Seed is an optional integer that defaults to Date.now().

getUint32()

Returns a 32-bit integer r (0 <= r < 2^32).

getFloat()

Returns a floating point number r (0.0 <= r < 1.0).

random()

Like getFloat() but dynamically bound to the XSadd instance.
You can use this function externally, like Math.random:

var XSadd = new XSadd();
var random = xsadd.random;
var number = random();

init(seed)

Reinitialize the generator with a new seed.

LICENSE

MIT

Keywords

FAQs

Last updated on 11 Aug 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc