Changeset 54aba8d
- Timestamp:
- Jan 2, 2018, 1:53:13 PM (7 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, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- b3048d4
- Parents:
- 490d9972
- Location:
- src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/stdlib
r490d9972 r54aba8d 10 10 // Created On : Thu Jan 28 17:12:35 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 1 17:35:43201813 // Update Count : 29 112 // Last Modified On : Tue Jan 2 12:21:04 2018 13 // Update Count : 292 14 14 // 15 15 … … 265 265 //--------------------------------------- 266 266 267 void random_seed( long int s ); 267 extern "C" { void srandom( unsigned int seed ); } // override C version 268 268 char random( void ); 269 269 char random( char u ); … … 275 275 unsigned int random( unsigned int u ); 276 276 unsigned int random( unsigned int l, unsigned int u ); 277 extern "C" { long int random( void ); } 277 extern "C" { long int random( void ); } // override C version 278 278 long int random( long int u ); 279 279 long int random( long int l, long int u ); -
src/libcfa/stdlib.c
r490d9972 r54aba8d 10 10 // Created On : Thu Jan 28 17:10:29 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 1 19:03:16201813 // Update Count : 4 3712 // Last Modified On : Tue Jan 2 12:20:32 2018 13 // Update Count : 441 14 14 // 15 15 … … 257 257 //--------------------------------------- 258 258 259 void random_seed( long int s ) { srand48( s ); srandom( s ); } // call srandom to harmonize with C-lib random 259 extern "C" { void srandom( unsigned int seed ) { srand48( seed ); } } // override C version 260 260 char random( void ) { return (unsigned long int)random(); } 261 261 char random( char u ) { return random( (unsigned long int)u ); } … … 267 267 unsigned int random( unsigned int u ) { return random( (unsigned long int)u ); } 268 268 unsigned int random( unsigned int l, unsigned int u ) { return random( (unsigned long int)l, (unsigned long int)u ); } 269 //extern "C" { long int random() { return mrand48(); } } 269 extern "C" { long int random( void ) { return mrand48(); } } // override C version 270 270 long int random( long int u ) { if ( u < 0 ) return random( u, 0 ); else return random( 0, u ); } 271 271 long int random( long int l, long int u ) { assert( l < u ); return lrand48() % (u - l) + l; } -
src/tests/.expect/random.txt
r490d9972 r54aba8d 2 2 = 3 3 V 4 2005783408 5 2 4 -911259971 6 5 6 7 861904956 8 7 9 10 10 630915564 11 8 12 5 13 697339851 14 5 15 19 16 0.61653 17 0.623932379138292 18 0.677254+0.678107i 19 0.298107334760999+0.951550630916653i 20 0.724141628787954517+0.188154303303139869i 6 -4 7 1232105397 8 0 9 18 10 -914096085 11 1 12 15 13 2077092859 14 1 15 11 16 0.677254 17 0.678106775246139 18 0.298107+0.951551i 19 0.724141628787955+0.18815430330314i 20 0.358747528448063235+0.27913860468074958i -
src/tests/concurrent/examples/boundedBuffer.c
r490d9972 r54aba8d 8 8 // Created On : Mon Oct 30 12:45:13 2017 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : T hu Dec 14 21:28:52 201711 // Update Count : 3 210 // Last Modified On : Tue Jan 2 12:18:18 2018 11 // Update Count : 33 12 12 // 13 13 … … 91 91 processor p; 92 92 93 // random_seed( getpid() );94 random_seed( 1003 );93 //srandom( getpid() ); 94 srandom( 1003 ); 95 95 96 96 for ( i = 0; i < Cons; i += 1 ) { // create consumers -
src/tests/concurrent/examples/datingService.c
r490d9972 r54aba8d 8 8 // Created On : Mon Oct 30 12:56:20 2017 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : Wed Dec 6 12:19:19 201711 // Update Count : 2 110 // Last Modified On : Tue Jan 2 12:19:01 2018 11 // Update Count : 22 12 12 // 13 13 … … 91 91 Boy *boys[NoOfPairs]; 92 92 93 random_seed( /*getpid()*/ 103 );93 srandom( /*getpid()*/ 103 ); 94 94 95 95 for ( unsigned int i = 0; i < NoOfPairs; i += 1 ) { -
src/tests/concurrent/signal/barge.c
r490d9972 r54aba8d 109 109 110 110 int main(int argc, char* argv[]) { 111 random_seed(0);111 srandom(0); 112 112 processor p; 113 113 { -
src/tests/concurrent/signal/block.c
r490d9972 r54aba8d 118 118 119 119 int main(int argc, char* argv[]) { 120 random_seed( time( NULL ) );120 srandom( time( NULL ) ); 121 121 done = false; 122 122 processor p; -
src/tests/concurrent/signal/disjoint.c
r490d9972 r54aba8d 109 109 // Main loop 110 110 int main(int argc, char* argv[]) { 111 random_seed( time( NULL ) );111 srandom( time( NULL ) ); 112 112 all_done = false; 113 113 processor p; -
src/tests/concurrent/signal/wait.c
r490d9972 r54aba8d 127 127 // Main 128 128 int main(int argc, char* argv[]) { 129 random_seed( time( NULL ) );129 srandom( time( NULL ) ); 130 130 waiter_left = 4; 131 131 processor p[2]; -
src/tests/concurrent/waitfor/recurse.c
r490d9972 r54aba8d 131 131 132 132 int main() { 133 random_seed( time(NULL) );133 srandom( time(NULL) ); 134 134 sout | "Starting" | endl; 135 135 { -
src/tests/concurrent/waitfor/simple.c
r490d9972 r54aba8d 74 74 int main(int argc, char* argv[]) { 75 75 done = false; 76 random_seed( time( NULL ) );76 srandom( time( NULL ) ); 77 77 printf("%p\n", &globalA); 78 78 sout | "Starting" | endl; -
src/tests/concurrent/waitfor/when.c
r490d9972 r54aba8d 77 77 78 78 int main() { 79 random_seed( time(NULL) );79 srandom( time(NULL) ); 80 80 sout | "Starting" | endl; 81 81 { -
src/tests/coroutine/prodcons.c
r490d9972 r54aba8d 10 10 // Created On : Mon Sep 18 12:23:39 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 5 22:40:55 201713 // Update Count : 4 612 // Last Modified On : Tue Jan 2 12:17:01 2018 13 // Update Count : 47 14 14 // 15 15 … … 90 90 Prod prod; 91 91 Cons cons = { prod }; 92 random_seed( /* getpid() */ 103 );// fixed seed for testing92 srandom( /* getpid() */ 103 ); // fixed seed for testing 93 93 start( prod, 5, cons ); 94 94 sout | "main stops" | endl; -
src/tests/random.c
r490d9972 r54aba8d 10 10 // Created On : Tue Jul 5 21:29:30 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Dec 24 07:48:23 201713 // Update Count : 1 812 // Last Modified On : Tue Jan 2 12:19:34 2018 13 // Update Count : 19 14 14 // 15 15 … … 19 19 20 20 int main() { 21 // random_seed( getpid() ); // set random seed22 random_seed( 1003 );// fixed seed for repeatable tests21 // srandom( getpid() ); // set random seed 22 srandom( 1003 ); // fixed seed for repeatable tests 23 23 24 24 // test polymorphic calls to random and stream
Note: See TracChangeset
for help on using the changeset viewer.