History

update makefiles

Ge Wang committed 3 years ago

Commit 37cf5f21 parent 2f2c9673 files · +14 −7Browse files

Showing the changes to src/core/util_math.cpp (1 of 3 files). Show all

Unified · Split

src/core/util_math.cpp+9−2
@@ -75,8 +75,16 @@ double trunc( double a ) · 74 unmodified lines
75// desc: chuck wrappers for random number generators75// desc: chuck wrappers for random number generators
76// 1.5.0.1 (ge) using mt19937 (requires c++11)76// 1.5.0.1 (ge) using mt19937 (requires c++11)
77//-----------------------------------------------------------------------------77//-----------------------------------------------------------------------------
78// mersenne twister RNG, based on the Mersenne prime (2^19937-1)
78static std::mt19937 g_ck_global_rng;79static std::mt19937 g_ck_global_rng;
80// ck_random() returns a signed int no greater than CK_RANDOM_MAX
81// to maintain parity between 64-bit and 32-bit systems, CK_RANDOM_MAX is set
82// to 0x7fffffff (or 2,147,483,647--the largest 32-bit signed number) rather
83// than mt19937's actual max of 0xffffffff (or 4,294,967,295, 2^32-1); this
84// is ensured using modulo; the slight skewing of the resulting RNG distribution
85// is considered acceptable
79t_CKINT ck_random() { return g_ck_global_rng() % CK_RANDOM_MAX; }86t_CKINT ck_random() { return g_ck_global_rng() % CK_RANDOM_MAX; }
87// seed the random number generator
80void ck_srandom( unsigned s ) { g_ck_global_rng.seed(s); }88void ck_srandom( unsigned s ) { g_ck_global_rng.seed(s); }
81//-----------------------------------------------------------------------------89//-----------------------------------------------------------------------------
82#else // using old school random (pre-c++11)90#else // using old school random (pre-c++11)
@@ -112,8 +120,7 @@ double ck_remainder( double a, double b ) · 29 unmodified lines
112 120
113 121
114 122
115// the following 6 functions are123// the following 6 functions are lifted from PD source
116// lifted from PD source
117// specifically x_acoustics.c124// specifically x_acoustics.c
118// http://puredata.info/downloads125// http://puredata.info/downloads
119#define LOGTWO 0.69314718055994528623126#define LOGTWO 0.69314718055994528623

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t