RNG Non-cryptographic

This module includes functions that generates non cryptographic random numbers.

Summary

Functions

otRandomNonCryptoAddJitter(uint32_t aValue, uint16_t aJitter)
uint32_t
Adds a random jitter within a given range to a given value.
otRandomNonCryptoFillBuffer(uint8_t *aBuffer, uint16_t aSize)
void
Fills a given buffer with random bytes.
otRandomNonCryptoGetUint16(void)
uint16_t
Generates and returns a random uint16_t value.
otRandomNonCryptoGetUint16InRange(uint16_t aMin, uint16_t aMax)
uint16_t
Generates and returns a random uint16_t value within a given range [aMin, aMax).
otRandomNonCryptoGetUint32(void)
uint32_t
Generates and returns a random uint32_t value.
otRandomNonCryptoGetUint32InRange(uint32_t aMin, uint32_t aMax)
uint32_t
Generates and returns a random uint32_t value within a given range [aMin, aMax).
otRandomNonCryptoGetUint8(void)
uint8_t
Generates and returns a random byte.
otRandomNonCryptoGetUint8InRange(uint8_t aMin, uint8_t aMax)
uint8_t
Generates and returns a random uint8_t value within a given range [aMin, aMax).

Functions

otRandomNonCryptoAddJitter

uint32_t otRandomNonCryptoAddJitter(
  uint32_t aValue,
  uint16_t aJitter
)

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

Details
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.

otRandomNonCryptoFillBuffer

void otRandomNonCryptoFillBuffer(
  uint8_t *aBuffer,
  uint16_t aSize
)

Fills a given buffer with random bytes.

Details
Parameters
[out] aBuffer
A pointer to a buffer to fill with the random bytes.
[in] aSize
Size of buffer (number of bytes to fill).

otRandomNonCryptoGetUint16

uint16_t otRandomNonCryptoGetUint16(
  void
)

Generates and returns a random uint16_t value.

Details
Returns
A random uint16_t value.

otRandomNonCryptoGetUint16InRange

uint16_t otRandomNonCryptoGetUint16InRange(
  uint16_t aMin,
  uint16_t aMax
)

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

Details
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 uint16_t value in the given range (i.e., aMin <= random value < aMax).

otRandomNonCryptoGetUint32

uint32_t otRandomNonCryptoGetUint32(
  void
)

Generates and returns a random uint32_t value.

Details
Returns
A random uint32_t value.

otRandomNonCryptoGetUint32InRange

uint32_t otRandomNonCryptoGetUint32InRange(
  uint32_t aMin,
  uint32_t aMax
)

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

Details
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 uint32_t value in the given range (i.e., aMin <= random value < aMax).

otRandomNonCryptoGetUint8

uint8_t otRandomNonCryptoGetUint8(
  void
)

Generates and returns a random byte.

Details
Returns
A random uint8_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).

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

Resources

OpenThread API Reference topics originate from the source code, available on GitHub. For more information, or to contribute to our documentation, refer to Resources.