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
7575 // desc: chuck wrappers for random number generators
7676 // 1.5.0.1 (ge) using mt19937 (requires c++11)
7777 //-----------------------------------------------------------------------------
78+// mersenne twister RNG, based on the Mersenne prime (2^19937-1)
7879 static 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
7986 t_CKINT ck_random() { return g_ck_global_rng() % CK_RANDOM_MAX; }
87+// seed the random number generator
8088 void ck_srandom( unsigned s ) { g_ck_global_rng.seed(s); }
8189 //-----------------------------------------------------------------------------
8290 #else // using old school random (pre-c++11)
@@ -112,8 +120,7 @@ double ck_remainder( double a, double b ) · 29 unmodified lines
112120
113121
114122
115−// the following 6 functions are
116−// lifted from PD source
123+// the following 6 functions are lifted from PD source
117124 // specifically x_acoustics.c
118125 // http://puredata.info/downloads
119126 #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