forked from SevenChords/CipesAtHome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpp_random_adapter.h
53 lines (40 loc) · 1.12 KB
/
cpp_random_adapter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* cpp_random_adapter.h
*
* Created on: Jun 14, 2021
* Author: TechSY730
*/
#ifndef CPP_RANDOM_ADAPTER_H_
#define CPP_RANDOM_ADAPTER_H_
#if _USE_CPP_RANDOM
#include <stdint.h>
#include "base.h"
#ifdef __cplusplus
extern "C" {
#endif
#if _USE_xoshiro_RANDOM
typedef uint64_t u_random_output_cpp_t;
typedef int64_t random_output_cpp_t;
typedef uint64_t random_seed_cpp_t;
#else
#if _CIPES_64_BIT_FOR_RANDOM && !_USE_lcg_RANDOM
// These will be checked for consistency statically in the cpp file
typedef uint_fast64_t u_random_output_cpp_t;
typedef int_fast64_t random_output_cpp_t;
typedef uint_fast64_t random_seed_cpp_t;
#else
typedef uint_fast32_t u_random_output_cpp_t;
typedef int_fast32_t random_output_cpp_t;
typedef uint_fast32_t random_seed_cpp_t;
#endif // _CIPES_64_BIT_FOR_RANDOM && !_USE_lcg_RANDOM
#endif
void cpp_rand_init();
void cpp_srand(random_seed_cpp_t seed);
u_random_output_cpp_t cpp_rand();
random_output_cpp_t cpp_randint(random_output_cpp_t low, random_output_cpp_t high);
void cpp_rand_destroy();
#ifdef __cplusplus
} // extern "C"
#endif
#endif // _USE_CPP_RANDOM
#endif /* CPP_RANDOM_ADAPTER_H_ */