Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
randLIB.h File Reference
Pseudo Random Library API: More...
Go to the source code of this file.
Functions | |
void | randLIB_seed_random (void) |
This library is made for getting random numbers for Timing needs in protocols. | |
uint8_t | randLIB_get_8bit (void) |
Generate 8-bit random number. | |
uint16_t | randLIB_get_16bit (void) |
Generate 16-bit random number. | |
uint32_t | randLIB_get_32bit (void) |
Generate 32-bit random number. | |
int8_t | randLIB_get_n_bytes_random (uint8_t *data_ptr, uint8_t eight_bit_boundary) |
Generate n-bytes random numbers. | |
uint16_t | randLIB_get_random_in_range (uint16_t min, uint16_t max) |
Generate a random number within a range. | |
uint32_t | randLIB_randomise_base (uint32_t base, uint16_t min_factor, uint16_t max_factor) |
Randomise a base 32-bit number by a jitter factor. |
Detailed Description
Pseudo Random Library API:
Network Bootstrap Control API:
- randLIB_seed_random(), Set seed for pseudo random
- randLIB_get_8bit(), Generate 8-bit random number
- randLIB_get_16bit(),Generate 16-bit random number
- randLIB_get_32bit(),Generate 32-bit random number
- randLIB_get_n_bytes_random(), Generate n-bytes random numbers
Definition in file randLIB.h.
Function Documentation
uint16_t randLIB_get_16bit | ( | void | ) |
Generate 16-bit random number.
- Parameters:
-
None
- Returns:
- 16-bit random number
Definition at line 56 of file linux/randLIB.c.
uint32_t randLIB_get_32bit | ( | void | ) |
Generate 32-bit random number.
- Parameters:
-
None
- Returns:
- 16-bit random number
- Parameters:
-
None
- Returns:
- 32-bit random number
Definition at line 70 of file linux/randLIB.c.
uint8_t randLIB_get_8bit | ( | void | ) |
Generate 8-bit random number.
- Parameters:
-
None
- Returns:
- 8-bit random number
Definition at line 42 of file linux/randLIB.c.
int8_t randLIB_get_n_bytes_random | ( | uint8_t * | data_ptr, |
uint8_t | eight_bit_boundary | ||
) |
Generate n-bytes random numbers.
- Parameters:
-
data_ptr pointer where random will be stored eight_bit_boundary how many bytes need random
- Returns:
- 0 process valid
- -1 Unsupported Parameters
- Parameters:
-
data_ptr pointer where random will be stored eight_bit_boundary how many bytes need random
- Returns:
- 0 process valid
- -1 Unsupported Parameters or failed to get random data.
Definition at line 87 of file linux/randLIB.c.
uint16_t randLIB_get_random_in_range | ( | uint16_t | min, |
uint16_t | max | ||
) |
Generate a random number within a range.
The result is linearly distributed in the range [min..max], inclusive.
- Parameters:
-
min minimum value that can be generated max maximum value that can be generated
Definition at line 112 of file linux/randLIB.c.
uint32_t randLIB_randomise_base | ( | uint32_t | base, |
uint16_t | min_factor, | ||
uint16_t | max_factor | ||
) |
Randomise a base 32-bit number by a jitter factor.
The result is linearly distributed in the jitter range, which is expressed as fixed-point unsigned 1.15 values. For example, to produce a number in the range [0.75 * base, 1.25 * base], set min_factor to 0x6000 and max_factor to 0xA000.
Result is clamped to 0xFFFFFFFF if it overflows.
- Parameters:
-
base The base 32-bit value min_factor The minimum value for the random factor max_factor The maximum value for the random factor
Definition at line 150 of file linux/randLIB.c.
void randLIB_seed_random | ( | void | ) |
This library is made for getting random numbers for Timing needs in protocols.
**not safe to use for security or cryptographic operations.** Init seed for Pseudo Random.
- Returns:
- None
This library is made for getting random numbers for Timing needs in protocols.
On a Linux, this does nothing.
- Returns:
- None
Definition at line 31 of file linux/randLIB.c.
Generated on Tue Jul 12 2022 17:35:04 by
