Changeset 20cf96d for libcfa/src/concurrency
- Timestamp:
- Nov 22, 2022, 11:03:19 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 78de1e5
- Parents:
- 29702ad
- Location:
- libcfa/src/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/thread.cfa
r29702ad r20cf96d 10 10 // Created On : Tue Jan 17 12:27:26 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Nov 20 17:17:50202213 // Update Count : 8 012 // Last Modified On : Tue Nov 22 22:18:37 2022 13 // Update Count : 81 14 14 // 15 15 … … 227 227 //----------------------------------------------------------------------------- 228 228 229 void set_seed( uint64_t seed ) {229 void set_seed( size_t seed ) { 230 230 PRNG_ARG_T & state = active_thread()->random_state; 231 231 state = __global_random_seed = seed; … … 235 235 } // set_seed 236 236 237 uint64_t prng( void ) { // [0,UINT_MAX]237 size_t prng( void ) { // [0,UINT_MAX] 238 238 PRNG_ARG_T & state = active_thread()->random_state; 239 239 return PRNG_NAME( state ); -
libcfa/src/concurrency/thread.hfa
r29702ad r20cf96d 10 10 // Created On : Tue Jan 17 12:27:26 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Nov 19 16:41:27202213 // Update Count : 3 012 // Last Modified On : Tue Nov 22 22:18:34 2022 13 // Update Count : 35 14 14 // 15 15 … … 142 142 //---------- 143 143 // prng 144 void set_seed( size_t seed ); 144 145 static inline { 145 uint64_t prng( thread$ & th ) __attribute__(( warn_unused_result )) { return PRNG_NAME( th.random_state ); } // [0,UINT_MAX]146 uint64_t prng( thread$ & th, uint64_t u ) __attribute__(( warn_unused_result )) { return prng( th ) % u; } // [0,u)147 uint64_t prng( thread$ & th, uint64_t l, uint64_t u ) __attribute__(( warn_unused_result )) { return prng( th, u - l + 1 ) + l; } // [l,u]146 size_t prng( thread$ & th ) __attribute__(( warn_unused_result )) { return PRNG_NAME( th.random_state ); } // [0,UINT_MAX] 147 size_t prng( thread$ & th, size_t u ) __attribute__(( warn_unused_result )) { return prng( th ) % u; } // [0,u) 148 size_t prng( thread$ & th, size_t l, size_t u ) __attribute__(( warn_unused_result )) { return prng( th, u - l + 1 ) + l; } // [l,u] 148 149 forall( T & | is_thread(T) ) { 149 uint64_t prng( T & th ) __attribute__(( warn_unused_result )) { return prng( (thread &)th ); } // [0,UINT_MAX]150 uint64_t prng( T & th, uint64_t u ) __attribute__(( warn_unused_result )) { return prng( th ) % u; } // [0,u)151 uint64_t prng( T & th, uint64_t l, uint64_t u ) __attribute__(( warn_unused_result )) { return prng( th, u - l + 1 ) + l; } // [l,u]150 size_t prng( T & th ) __attribute__(( warn_unused_result )) { return prng( (thread &)th ); } // [0,UINT_MAX] 151 size_t prng( T & th, size_t u ) __attribute__(( warn_unused_result )) { return prng( th ) % u; } // [0,u) 152 size_t prng( T & th, size_t l, size_t u ) __attribute__(( warn_unused_result )) { return prng( th, u - l + 1 ) + l; } // [l,u] 152 153 } // distribution 153 154 } // distribution
Note: See TracChangeset
for help on using the changeset viewer.