When using a custom random function, please ensure it returns a positive number
no greater than 2 ** bits - 1.
[RND_FUNCTION_RETURN_TYPE] If custom function does not return number or bigint, or if the value is out of range.
The number of bits for the fragment.
Optional fn: (() => number | bigint)Optional custom random function.
The bit mask used to isolate the fragment's bits from the snowflake.
bitMask is equal to maxValue << bitShift
The hexadecimal representation of the bit mask as string.
The number of bits for left and right shifting.
bitShift is equal to the number of bits on the right side
Readonly bitsThe number of bits for the fragment.
Private Optional Readonly fnOptional custom random function.
The fragment identifier.
Readonly maxThe maximum value that can be represented by this fragment.
maxValue is equal to 2 ** bits - 1
The current value of the fragment.
Internal
Returns a destructured fragment.
Do not use this method outside of a Snowflakify instance.
A destructured fragment object with the following properties:
identifier: The identifier of the ID.value: The value of the fragment for that snowflake.The snowflake to destructure.
Generated using TypeDoc
RandomFragment class for random IDs.