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
N/A

Returns

  • A random uint32_t value.


Definition at line 60 of file include/openthread/random_noncrypto.h

otRandomNonCryptoGetUint8#

uint8_t otRandomNonCryptoGetUint8 (void )

Generates and returns a random byte.

Parameters
N/A

Returns

  • A random uint8_t value.


Definition at line 68 of file include/openthread/random_noncrypto.h

otRandomNonCryptoGetUint16#

uint16_t otRandomNonCryptoGetUint16 (void )

Generates and returns a random uint16_t value.

Parameters
N/A

Returns

  • A random uint16_t value.


Definition at line 76 of file include/openthread/random_noncrypto.h

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
[in]aMin

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

[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).


Definition at line 86 of file include/openthread/random_noncrypto.h

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
[in]aMin

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

[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).


Definition at line 98 of file include/openthread/random_noncrypto.h

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
[in]aMin

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

[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).


Definition at line 111 of file include/openthread/random_noncrypto.h

otRandomNonCryptoFillBuffer#

void otRandomNonCryptoFillBuffer (uint8_t * aBuffer, uint16_t aSize)

Fills a given buffer with random bytes.

Parameters
[out]aBuffer

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

[in]aSize

Size of buffer (number of bytes to fill).


Definition at line 120 of file include/openthread/random_noncrypto.h

otRandomNonCryptoAddJitter#

uint32_t otRandomNonCryptoAddJitter (uint32_t aValue, uint16_t aJitter)

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

Parameters
[in]aValue

A value to which the random jitter is added.

[in]aJitter

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

Returns

  • The given value with an added random jitter.


Definition at line 131 of file include/openthread/random_noncrypto.h