Rizky Ardi Maulana / mbed-os
Embed: (wiki syntax)

« Back to documentation index

randLIB.h File Reference

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:

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_ptrpointer where random will be stored
eight_bit_boundaryhow many bytes need random
Returns:
0 process valid
-1 Unsupported Parameters
Parameters:
data_ptrpointer where random will be stored
eight_bit_boundaryhow 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:
minminimum value that can be generated
maxmaximum 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:
baseThe base 32-bit value
min_factorThe minimum value for the random factor
max_factorThe 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.