- Timestamp:
- Feb 12, 2022, 5:29:55 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- a38bbbc
- Parents:
- 0db48ca
- Location:
- libcfa/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/thread.cfa
r0db48ca r0ebbca4 10 10 // Created On : Tue Jan 17 12:27:26 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Feb 12 08:45:33202213 // Update Count : 6 512 // Last Modified On : Sat Feb 12 15:24:18 2022 13 // Update Count : 66 14 14 // 15 15 … … 176 176 177 177 void set_seed( uint32_t seed ) { 178 active_thread()->random_state = __global_random_seed = seed; 179 GENERATOR( active_thread()->random_state ); 180 __global_random_prime = active_thread()->random_state; 178 uint32_t & state = active_thread()->random_state; 179 state = __global_random_seed = seed; 180 GENERATOR( state ); 181 __global_random_prime = state; 181 182 __global_random_mask = true; 182 183 } // set_seed -
libcfa/src/stdlib.hfa
r0db48ca r0ebbca4 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 10 18:34:58202213 // Update Count : 64 112 // Last Modified On : Sat Feb 12 17:22:25 2022 13 // Update Count : 643 14 14 // 15 15 … … 412 412 void set_seed( PRNG & prng, uint32_t seed_ ); 413 413 static inline { 414 void ?{}( PRNG & prng ) { set_seed( prng, rdtscl() ); }// random seed415 void ?{}( PRNG & prng, uint32_t seed ) {set_seed( prng, seed ); } // fixed seed414 void ?{}( PRNG & prng ) with( prng ) { callcnt = 0; set_seed( prng, rdtscl() ); } // random seed 415 void ?{}( PRNG & prng, uint32_t seed ) with( prng ) { callcnt = 0; set_seed( prng, seed ); } // fixed seed 416 416 uint32_t get_seed( PRNG & prng ) __attribute__(( warn_unused_result )) with( prng ) { return seed; } // get seed 417 417 uint32_t prng( PRNG & prng ) __attribute__(( warn_unused_result )) with( prng ) { callcnt += 1; return LCG( state ); } // [0,UINT_MAX]
Note: See TracChangeset
for help on using the changeset viewer.