Published Feb 06
pjs.basicRNG()
This API was added in version 7.17.0
This API is intended primarily for RPG to JavaScript code transformation scenarios, and provides a drop-in alternative to CEERAN0.
For new code, it’s recommended to use standard JS method Math.random()
Note: Neither this API nor Math.random()
are suitable for generating cryptographically secure random numbers. For that, use Node.js crypto
APIs instead.
This API generates a random number between 0 and 1, exclusive. Numbers are generated using Math.random()
.
Parameters
Seed (number). This parameter is included only for function signature compatibility with
CEERAN0
and is ignored.Random number (field name). A numeric field name defined with
pjs.define()
that will receive the random number.
Example
pjs.define("random_num", { type: 'float', length: 8 });
pjs.basicRNG(0, random_num);
console.log(random_num);
Looking for labels? They can now be found in the details panel on the floating action bar.