Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
rw_rand.h
Go to the documentation of this file.
1
29#ifndef RW_RAND_H_INCLUDED
30#define RW_RAND_H_INCLUDED
31
32#include <rw/_defs.h> // for libstd config macros
33
34#include <rw_testdefs.h> // for test config macros
35
36// seeds the 32-bit random number generator
37// if the seed is equal UINT32_MAX picks a random value to seed
38// the generator with
39_TEST_EXPORT void
40rw_seed32 (_RWSTD_UINT32_T);
41
42// returns a 32-bit random number in the range [0, limit)
43// if limit is non-zero, otherwise in the range [0, UINT32_MAX)
44_TEST_EXPORT _RWSTD_UINT32_T
45rw_rand32 (_RWSTD_UINT32_T = 0);
46
47#ifdef _RWSTD_UINT64_T
48
49// seeds the 64-bit random number generator
50// if the seed is equal UINT64_MAX picks a random value to seed
51// the generator with
52_TEST_EXPORT void
53rw_seed64 (_RWSTD_UINT64_T);
54
55// returns a 64-bit random number in the range [0, limit)
56// if limit is non-zero, otherwise in the range [0, UINT64_MAX)
57_TEST_EXPORT _RWSTD_UINT64_T
58rw_rand64 (_RWSTD_UINT64_T = 0);
59
60# if 32 == _RWSTD_INT_SIZE
61# define rw_seed(limit) rw_seed32 (limit)
62# define rw_rand(limit) rw_rand32 (limit)
63# else // if 32 != _RWSTD_INT_SIZE
64# define rw_seed(limit) rw_seed64 (limit)
65# define rw_rand(limit) rw_rand64 (limit)
66# endif // 32 == _RWSTD_INT_SIZE
67#else // if !defined (_RWSTD_UINT64_T)
68# define rw_seed(limit) rw_seed32 (limit)
69# define rw_rand(limit) rw_rand32 (limit)
70#endif // _RWSTD_UINT64_T
71
72#endif // RW_RAND_H_INCLUDED
_TEST_EXPORT void rw_seed32(_RWSTD_UINT32_T)
Definition rand.cpp:44
_TEST_EXPORT _RWSTD_UINT32_T rw_rand32(_RWSTD_UINT32_T=0)
Definition rand.cpp:74
#define _TEST_EXPORT
Definition rw_testdefs.h:55