Changes in libcfa/src/stdlib.hfa [aa0a1ad:2210cfc]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/stdlib.hfa
raa0a1ad r2210cfc 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Jan 2 22:53:57202213 // Update Count : 59412 // Last Modified On : Mon Jan 10 17:03:18 2022 13 // Update Count : 619 14 14 // 15 15 … … 21 21 #include <stdlib.h> // *alloc, strto*, ato* 22 22 #include <heap.hfa> 23 23 24 24 25 // Reduce includes by explicitly defining these routines. … … 391 392 }; // PRNG 392 393 393 externuint32_t prng( PRNG & prng ) __attribute__(( warn_unused_result )); // [0,UINT_MAX]394 uint32_t prng( PRNG & prng ) __attribute__(( warn_unused_result )); // [0,UINT_MAX] 394 395 static inline { 395 396 void set_seed( PRNG & prng, uint32_t seed_ ) with( prng ) { state = seed = seed_; } // set seed … … 402 403 } // distribution 403 404 404 extern void set_seed( uint32_t seed ); // set per thread seed 405 extern uint32_t get_seed(); // get seed 406 extern uint32_t prng( void ) __attribute__(( warn_unused_result )); // [0,UINT_MAX]405 void set_seed( uint32_t seed_ ) OPTIONAL_THREAD; 406 uint32_t get_seed() __attribute__(( warn_unused_result )); 407 uint32_t prng( void ) __attribute__(( warn_unused_result )) OPTIONAL_THREAD; // [0,UINT_MAX] 407 408 static inline { 408 uint32_t prng( uint32_t u ) __attribute__(( warn_unused_result )); 409 uint32_t prng( uint32_t u ) { return prng() % u; } // [0,u) 410 uint32_t prng( uint32_t l, uint32_t u ) __attribute__(( warn_unused_result )); 411 uint32_t prng( uint32_t l, uint32_t u ) { return prng( u - l + 1 ) + l; } // [l,u] 409 uint32_t prng( uint32_t u ) __attribute__(( warn_unused_result )) { return prng() % u; } // [0,u) 410 uint32_t prng( uint32_t l, uint32_t u ) __attribute__(( warn_unused_result )) { return prng( u - l + 1 ) + l; } // [l,u] 412 411 } // distribution 413 412
Note:
See TracChangeset
for help on using the changeset viewer.