API reference / @jsprismarine/prismarine / utils/Random
utils/Random
Type Aliases
Random
Random = () =>
number
Defined in: packages/prismarine/src/utils/Random.ts:10
A source of chance: a number in [0, 1), the way Math.random gives one.
Returns
number
Functions
randomOf()
randomOf(
server):Random
Defined in: packages/prismarine/src/utils/Random.ts:21
The server's own source of chance, or the global one when it has none.
Written against the one method it needs rather than against Server, so a stand-in server in a test satisfies it without being one.
Parameters
server
{ getRandom?: () => Random; } | null | undefined
The server the roll happened on.
Returns
The source of chance.