|
Graphviz 14.0.3~dev.20251109.1720
|
random number generation More...
Go to the source code of this file.
Functions | |
| UTIL_API int * | gv_permutation (int bound) |
| UTIL_API int | gv_random (int bound) |
| UTIL_API uint64_t | gv_random_u64 (uint64_t bound) |
| UTIL_API int * gv_permutation | ( | int | bound | ) |
generate a random permutation of the numbers [0, bound - 1]
The caller is responsible for freeing the returned array. This function calls exit on memory allocation failure.
| bound | Exclusive upper bound on the sequence |
[0, bound - 1] Definition at line 13 of file random.c.
References gv_calloc(), gv_random(), NULL, and SWAP.
Referenced by maximal_independent_edge_set_heavest_edge_pernode_supernodes_first().
| UTIL_API int gv_random | ( | int | bound | ) |
generate a random number in the range [0, bound - 1]
This function assumes the caller has previously seeded the rand random number generator.
| bound | Exclusive upper bound on random number generation |
Definition at line 83 of file random.c.
References gv_random_u64(), and random_small().
Referenced by gv_permutation(), and node_distinct_coloring_internal().
| UTIL_API uint64_t gv_random_u64 | ( | uint64_t | bound | ) |
generate a random 64-bit unsigned number in the range [0, bound - 1]
This function assumes the caller has previously seeded the rand random number generator.
| bound | Exclusive upper bound on random number generation |
Definition at line 59 of file random.c.
References random_small(), and UINT8_MAX.
Referenced by genTree(), and gv_random().