Simulated product dispenser

Dependencies:   HTS221

Fork of mbed-cloud-workshop-connect-HTS221 by Jim Carver

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.
void randLIB_add_seed (uint64_t seed)
 Update seed for pseudo-random generator.
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.
uint64_t randLIB_get_64bit (void)
 Generate 64-bit random number.
void * randLIB_get_n_bytes_random (void *data_ptr, uint8_t count)
 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

void randLIB_add_seed ( uint64_t  seed )

Update seed for pseudo-random generator.

Adds seed information to existing generator, to perturb the sequence.

Parameters:
seed64 bits of data to add to the seed.

Definition at line 115 of file randLIB.c.

uint16_t randLIB_get_16bit ( void   )

Generate 16-bit random number.

Parameters:
None
Returns:
16-bit random number

Definition at line 135 of file randLIB.c.

uint32_t randLIB_get_32bit ( void   )

Generate 32-bit random number.

Parameters:
None
Returns:
32-bit random number

Definition at line 141 of file randLIB.c.

uint64_t randLIB_get_64bit ( void   )

Generate 64-bit random number.

Parameters:
None
Returns:
64-bit random number

Definition at line 148 of file randLIB.c.

uint8_t randLIB_get_8bit ( void   )

Generate 8-bit random number.

Parameters:
None
Returns:
8-bit random number

Definition at line 129 of file randLIB.c.

void* randLIB_get_n_bytes_random ( void *  data_ptr,
uint8_t  count 
)

Generate n-bytes random numbers.

Parameters:
data_ptrpointer where random will be stored
counthow many bytes need random
Returns:
data_ptr

Definition at line 172 of file 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 188 of file 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 250 of file 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.

Makes call(s) to the platform's arm_random_seed_get() to seed the pseudo-random generator.

Returns:
None

Definition at line 85 of file randLIB.c.