RNG Non-cryptographic#

This module includes functions that generates non cryptographic random numbers.

Functions#

uint32_t

Generates and returns a random uint32_t value.

uint8_t

Generates and returns a random byte.

uint16_t

Generates and returns a random uint16_t value.

uint8_t
otRandomNonCryptoGetUint8InRange(uint8_t aMin, uint8_t aMax)

Generates and returns a random uint8_t value within a given range [aMin, aMax).

uint16_t
otRandomNonCryptoGetUint16InRange(uint16_t aMin, uint16_t aMax)

Generates and returns a random uint16_t value within a given range [aMin, aMax).

uint32_t
otRandomNonCryptoGetUint32InRange(uint32_t aMin, uint32_t aMax)

Generates and returns a random uint32_t value within a given range [aMin, aMax).

void
otRandomNonCryptoFillBuffer(uint8_t *aBuffer, uint16_t aSize)

Fills a given buffer with random bytes.

uint32_t
otRandomNonCryptoAddJitter(uint32_t aValue, uint16_t aJitter)

Adds a random jitter within a given range to a given value.

Function Documentation#

otRandomNonCryptoGetUint32#

uint32_t otRandomNonCryptoGetUint32 (void )

Generates and returns a random uint32_t value.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • A random uint32_t value.


otRandomNonCryptoGetUint8#

uint8_t otRandomNonCryptoGetUint8 (void )

Generates and returns a random byte.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • A random uint8_t value.


otRandomNonCryptoGetUint16#

uint16_t otRandomNonCryptoGetUint16 (void )

Generates and returns a random uint16_t value.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • A random uint16_t value.


otRandomNonCryptoGetUint8InRange#

uint8_t otRandomNonCryptoGetUint8InRange (uint8_t aMin, uint8_t aMax)

Generates and returns a random uint8_t value within a given range [aMin, aMax).

Parameters
TypeDirectionArgument NameDescription
uint8_t[in]aMin

A minimum value (this value can be included in returned random result).

uint8_t[in]aMax

A maximum value (this value is excluded from returned random result).

Returns

  • A random uint8_t value in the given range (i.e., aMin <= random value < aMax).


otRandomNonCryptoGetUint16InRange#

uint16_t otRandomNonCryptoGetUint16InRange (uint16_t aMin, uint16_t aMax)

Generates and returns a random uint16_t value within a given range [aMin, aMax).

Parameters
TypeDirectionArgument NameDescription
uint16_t[in]aMin

A minimum value (this value can be included in returned random result).

uint16_t[in]aMax

A maximum value (this value is excluded from returned random result).

Note

  • The returned random value can include the aMin value but excludes the aMax.

Returns

  • A random uint16_t value in the given range (i.e., aMin <= random value < aMax).


otRandomNonCryptoGetUint32InRange#

uint32_t otRandomNonCryptoGetUint32InRange (uint32_t aMin, uint32_t aMax)

Generates and returns a random uint32_t value within a given range [aMin, aMax).

Parameters
TypeDirectionArgument NameDescription
uint32_t[in]aMin

A minimum value (this value can be included in returned random result).

uint32_t[in]aMax

A maximum value (this value is excluded from returned random result).

Note

  • The returned random value can include the aMin value but excludes the aMax.

Returns

  • A random uint32_t value in the given range (i.e., aMin <= random value < aMax).


otRandomNonCryptoFillBuffer#

void otRandomNonCryptoFillBuffer (uint8_t * aBuffer, uint16_t aSize)

Fills a given buffer with random bytes.

Parameters
TypeDirectionArgument NameDescription
uint8_t *[out]aBuffer

A pointer to a buffer to fill with the random bytes.

uint16_t[in]aSize

Size of buffer (number of bytes to fill).


otRandomNonCryptoAddJitter#

uint32_t otRandomNonCryptoAddJitter (uint32_t aValue, uint16_t aJitter)

Adds a random jitter within a given range to a given value.

Parameters
TypeDirectionArgument NameDescription
uint32_t[in]aValue

A value to which the random jitter is added.

uint16_t[in]aJitter

Maximum jitter. Random jitter is selected from the range [-aJitter, aJitter].

Returns

  • The given value with an added random jitter.