cctools
random.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The University of Notre Dame
3 * This software is distributed under the GNU General Public License.
4 * See the file COPYING for details.
5 */
6
7#ifndef RANDOM_H
8#define RANDOM_H
9
10#include <stdint.h>
11#include <stdlib.h>
12
20void random_init (void);
21
26#define random_int() ((int) random_int64())
27
32#define random_uint() ((unsigned) random_int64())
33
38#define random_int32() ((int32_t) random_int64())
39
44int64_t random_int64 (void);
45
50double random_double (void);
51
57void random_array (void *m, size_t l);
58
64void random_hex (char *s, size_t l);
65
66#endif
67
68/* vim: set noexpandtab tabstop=8: */
void random_array(void *m, size_t l)
Insert random data into an array.
double random_double(void)
Get a random double from (0, 1)
int64_t random_int64(void)
Get a random int64_t.
void random_hex(char *s, size_t l)
Insert a random string in hexadecimal.
void random_init(void)
Initialize the random number generator.