Reference · Streams, draws and seeds
hashSeedfunction
A seed from any text: hashSeed("room-7") is the same unsigned 32-bit
integer everywhere. FNV-1a over the UTF-16 code units, then MurmurHash3's
finaliser, so "a" and "b" land far apart. Use it to seed from a name, a
room code or a date string.
Import it
import { hashSeed } from "@johnmorrisdotca/tane";
Definition
function hashSeed(text: string): number
Parameters
| Name | Type | Description |
|---|---|---|
text | string | Text to hash, validate or decode. |
Returns
number
A seed from any text: hashSeed("room-7") is the same unsigned 32-bit integer everywhere. FNV-1a over the UTF-16 code units, then MurmurHash3's finaliser, so "a" and "b" land far apart. Use it to seed from a name, a room code or a date string.
Examples
import { hashSeed } from "@johnmorrisdotca/tane";
console.log(hashSeed("room-7"));948657874What it prints (run when this page was built)