Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/PRNG.cfa

    ree4b77b r5910fc0  
    88// Created On       : Wed Dec 29 09:38:12 2021
    99// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Sat Apr  9 15:21:14 2022
    11 // Update Count     : 344
     10// Last Modified On : Fri Feb 11 08:16:43 2022
     11// Update Count     : 328
    1212//
    1313
     
    2020#include <malloc.h>                                                                             // malloc_stats
    2121#include <locale.h>                                                                             // setlocale
    22 #include <mutex_stmt.hfa>
     22
     23// FIX ME: spurious characters appear in output
     24Duration default_preemption() { return 0; }
    2325
    2426#ifdef TIME                                                                                             // use -O2 -nodebug
     
    4850        } // for
    4951        double std = sqrt( sum / BUCKETS );
    50         mutex( sout ) sout | "trials"  | TRIALS | "buckets" | BUCKETS
    51                 | "min" | min | "max" | max
    52                 | "avg" | wd(0,1, avg) | "std" | wd(0,1, std) | "rstd" | wd(0,1, (avg == 0 ? 0.0 : std / avg * 100)) | "%";
     52        sout | "trials"  | TRIALS | "buckets" | BUCKETS
     53                 | "min" | min | "max" | max
     54                 | "avg" | wd(0,1, avg) | "std" | wd(0,1, std) | "rstd" | wd(0,1, (avg == 0 ? 0.0 : std / avg * 100)) | "%";
    5355} // avgstd
    5456
    55 
    5657uint32_t seed = 1009;
     58
    5759
    5860thread T1 {};
     
    9294        unsigned int * buckets = calloc( BUCKETS );                     // too big for task stack
    9395        for ( TRIALS ) {
    94                 buckets[prng( th ) % BUCKETS] += 1;     // concurrent
     96                buckets[prng( (thread$ &)th ) % BUCKETS] += 1;  // concurrent
    9597        } // for
    9698        avgstd( buckets );
Note: See TracChangeset for help on using the changeset viewer.