murmur-numbers
v0.0.2
Published
Murmur3 hash that takes integers as inputs and outputs [0..1]
Downloads
5
Readme
murmur-numbers
Simple fork of Gary Court's murmur3 implementation.
The only important difference is the inputs and outputs -
instead of hashing text into a 32-bit integer, this version takes a
series of integers, and divides the output into a float in the range
[0..1)
(i.e. same as Math.random
).
Installation:
npm install --save murmur-numbers
Usage:
var seed = 12345
var hash = require('murmur-numbers')(seed)
hash(5) // 0.4604153847321868
hash(0, 5) // 0.585702647222206
hash(5, 0) // 0.8242928483523428
hash(5) === hash(5) // true