generateRandomU256
Umbra SDK reference for Generate Random U256.
generateRandomU256():
U256
Defined in: src/utils/miscellaneous.ts:432
Generates a uniformly random 256-bit value.
Returns
A random U256 value sampled from 32 bytes of cryptographic randomness.
Remarks
This function uses randomBytes(32) to obtain 32 bytes of entropy and then interprets the
resulting Uint8Array as a little-endian 256-bit integer.
Example
const randomValue: U256 = generateRandomU256();
console.log(randomValue.toString());