Random generators
-
void urand_set_seed(ulib_uint seed)
Sets the seed of the random number generator.
- Parameters:
seed – Seed.
-
UString const *urand_default_charset(void)
Returns the default character set used by random string generators.
- Returns:
Default character set.
-
ulib_int urand_range(ulib_int start, ulib_uint len)
Returns a random integer in the specified range.
- Parameters:
start – Start of the range.
len – Length of the range.
- Returns:
Random integer.
-
ulib_float urand_float(void)
Returns a random float between 0.0 and 1.0.
- Returns:
Random float.
-
ulib_float urand_float_range(ulib_float start, ulib_float len)
Returns a random float in the specified range.
- Parameters:
start – Start of the range.
len – Length of the range.
- Returns:
Random float.
-
UString urand_string(ulib_uint len, UString const *charset)
Returns a random string.
Note
The returned object must be destroyed by calling
ustring_deinit()
.- Parameters:
len – Length of the string.
charset – Character set, or NULL for the default alphanumeric character set.
- Returns:
Random string.