fn-mt
functional implementation of Mersenne Twister
Last updated 6 months ago by a_kirisaki .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install fn-mt 
SYNC missed versions from official npm registry.

fn-mt

Functional implementation of Mersenne Twister

Usage

import { newRandGen, randNext, randRange } from 'fn-mt'

const gen = newRandGen(42)

const [n1, gen1] = randNext(gen)
const [n2, gen2] = randNext(gen1)
const [n3, gen3] = randNext(gen2)

console.log(n1)
console.log(n2)
console.log(n3)

// same generator generate same number
const [n4, gen4] = randNext(gen2)

console.log(n4)

// ranged int
const [n5, gen5] = randRange(0, 6, gen4)

console.log(n5) // generate integer from 0 to 5

Current Tags

  • 1.2.1                                ...           latest (6 months ago)

5 Versions

  • 1.2.1                                ...           6 months ago
  • 1.2.0                                ...           7 months ago
  • 1.0.3                                ...           7 months ago
  • 1.0.1                                ...           7 months ago
  • 1.0.0                                ...           7 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |