Skip to content

Murmur3 hash that takes integers as inputs and outputs [0..1]

Notifications You must be signed in to change notification settings

fenomas/murmur-numbers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Murmur3 hash that takes integers as inputs and outputs [0..1]

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published