alchimystic
alchimystic/defold-rng/rng
Factory of random number generator instances (non-global) for specific algorithms. Supports pcg32
- GitHub: alchimystic/defold-rng — pinned to
v1.3.0(released while Defold 1.14.0 was current)- Pick a release from alchimystic/defold-rng releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as rnd from "rnd"
- Pick a release from alchimystic/defold-rng releases and add its Source code (zip) URL (or a packaged
- Asset Portal: defold-rng
Functions
rnd.pcg32(init_state: number, init_seq: number)
Creates a pcg32 instance. Can specify init_state and init_seq to start with a seed, or nothing to get a random one
Parameters
init_state:number— init_state is the starting state for the PCG32, you can pass any 64-bit value.init_seq:number— init_seq selects the output sequence for the PCG32, you can pass any 64-bit value, although only the low 63 bits are significant.