Changeset 470618c0
- Timestamp:
- Feb 12, 2022, 1:55:07 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 4708eaa
- Parents:
- c655650
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/PRNG.cfa
rc655650 r470618c0 8 8 // Created On : Wed Dec 29 09:38:12 2021 9 9 // Last Modified By : Peter A. Buhr 10 // Last Modified On : Fri Feb 11 08:16:43202211 // Update Count : 3 2810 // Last Modified On : Sat Feb 12 12:23:57 2022 11 // Update Count : 342 12 12 // 13 13 … … 20 20 #include <malloc.h> // malloc_stats 21 21 #include <locale.h> // setlocale 22 #include <mutex_stmt.hfa> 22 23 23 24 // FIX ME: spurious characters appear in output … … 50 51 } // for 51 52 double std = sqrt( sum / BUCKETS ); 52 sout | "trials" | TRIALS | "buckets" | BUCKETS53 54 53 mutex( sout ) sout | "trials" | TRIALS | "buckets" | BUCKETS 54 | "min" | min | "max" | max 55 | "avg" | wd(0,1, avg) | "std" | wd(0,1, std) | "rstd" | wd(0,1, (avg == 0 ? 0.0 : std / avg * 100)) | "%"; 55 56 } // avgstd 56 57 58 57 59 uint32_t seed = 1009; 58 59 60 60 61 thread T1 {}; … … 94 95 unsigned int * buckets = calloc( BUCKETS ); // too big for task stack 95 96 for ( TRIALS ) { 96 buckets[prng( (thread$ &)th ) % BUCKETS] += 1; // concurrent97 buckets[prng( th ) % BUCKETS] += 1; // concurrent 97 98 } // for 98 99 avgstd( buckets );
Note: See TracChangeset
for help on using the changeset viewer.