Changeset bbe1a87 for src/libcfa/stdlib
- Timestamp:
- Jul 3, 2018, 9:07:31 AM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 9459c01, e3b2474
- Parents:
- 4c3ee8d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/stdlib
r4c3ee8d rbbe1a87 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jun 2 08:46:35201813 // Update Count : 3 0612 // Last Modified On : Tue Jul 3 08:17:28 2018 13 // Update Count : 324 14 14 // 15 15 … … 264 264 //--------------------------------------- 265 265 266 extern "C" { void srandom( unsigned int seed ); } // override C version 267 char random( void ); 268 char random( char u ); 269 char random( char l, char u ); 270 int random( void ); 271 int random( int u ); 272 int random( int l, int u ); 273 unsigned int random( void ); 274 unsigned int random( unsigned int u ); 275 unsigned int random( unsigned int l, unsigned int u ); 276 extern "C" { long int random( void ); } // override C version 277 long int random( long int u ); 278 long int random( long int l, long int u ); 279 unsigned long int random( void ); 280 unsigned long int random( unsigned long int u ); 281 unsigned long int random( unsigned long int l, unsigned long int u ); 282 float random( void ); 283 double random( void ); 284 float _Complex random( void ); 285 double _Complex random( void ); 286 long double _Complex random( void ); 266 extern "C" { // override C version 267 void srandom( unsigned int seed ); 268 long int random( void ); 269 } // extern "C" 270 271 static inline { 272 long int random( long int l, long int u ) { if ( u < l ) [u, l] = [l, u]; return lrand48() % (u - l) + l; } // [l,u) 273 long int random( long int u ) { if ( u < 0 ) return random( u, 0 ); else return random( 0, u ); } // [0,u) 274 unsigned long int random( void ) { return lrand48(); } 275 unsigned long int random( unsigned long int l, unsigned long int u ) { if ( u < l ) [u, l] = [l, u]; return lrand48() % (u - l) + l; } // [l,u) 276 unsigned long int random( unsigned long int u ) { return lrand48() % u; } // [0,u) 277 278 char random( void ) { return (unsigned long int)random(); } 279 char random( char u ) { return random( (unsigned long int)u ); } // [0,u) 280 char random( char l, char u ) { return random( (unsigned long int)l, (unsigned long int)u ); } // [l,u) 281 int random( void ) { return (long int)random(); } 282 int random( int u ) { return random( (long int)u ); } // [0,u] 283 int random( int l, int u ) { return random( (long int)l, (long int)u ); } // [l,u) 284 unsigned int random( void ) { return (unsigned long int)random(); } 285 unsigned int random( unsigned int u ) { return random( (unsigned long int)u ); } // [0,u] 286 unsigned int random( unsigned int l, unsigned int u ) { return random( (unsigned long int)l, (unsigned long int)u ); } // [l,u) 287 } // distribution 288 289 float random( void ); // [0.0, 1.0) 290 double random( void ); // [0.0, 1.0) 291 float _Complex random( void ); // [0.0, 1.0)+[0.0, 1.0)i 292 double _Complex random( void ); // [0.0, 1.0)+[0.0, 1.0)i 293 long double _Complex random( void ); // [0.0, 1.0)+[0.0, 1.0)i 287 294 288 295 //---------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.