polserver/pol-core/support/scripts/util.em
Kevin Eady c029ca4283
Add module function util::RandomUUID() (#803)
* implementation

* tests

* docs

* add uuid_nil, uuid_max

* add support for v4 or v7 uuid generation
2025-08-16 13:39:34 +02:00

20 lines
658 B
Text

const UUID_NIL := "00000000-0000-0000-0000-000000000000";
const UUID_MAX := "ffffffff-ffff-ffff-ffff-ffffffffffff";
RandomInt( below_this_number ); // returns integer R such that 0 <= R < B
RandomIntMinMax( minValue, maxValue ); // returns integer R such that minValue<=R<maxValue
RandomFloat( below_this_float ); // returns float R such that 0.0 <= R < B
RandomUUID( version := 4 );
// formats for RandomDiceRoll dice_string parameter:
// 4
// d4
// d6+6
// d6-2
// 2d12
// 2d8+12
// 2d8-4
// Returns an integer >= 0
RandomDiceRoll( dice_string, allow_negatives := 0 );
StrFormatTime( format_string, time_stamp := 0 );