Ignore:
Timestamp:
Feb 9, 2022, 10:59:05 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
454b4e0
Parents:
7a15b7e
Message:

add fast PRNG code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/stdlib.hfa

    r7a15b7e r12b5e94a  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jan 13 21:34:46 2022
    13 // Update Count     : 636
     12// Last Modified On : Sat Jan 15 09:57:28 2022
     13// Update Count     : 640
    1414//
    1515
     
    1818#include "bits/defs.hfa"                                                                // OPTIONAL_THREAD
    1919#include "bits/align.hfa"                                                               // libAlign
     20#include "bits/random.hfa"                                                              // prng
    2021
    2122#include <stdlib.h>                                                                             // *alloc, strto*, ato*
     
    410411
    411412void set_seed( PRNG & prng, uint32_t seed_ );
    412 uint32_t prng( PRNG & prng ) __attribute__(( warn_unused_result )); // [0,UINT_MAX]
    413413static inline {
     414        uint32_t prng( PRNG & prng ) __attribute__(( warn_unused_result )) with( prng ) { callcnt += 1; return LCG( state ); } // [0,UINT_MAX]
    414415        void ?{}( PRNG & prng ) { set_seed( prng, rdtscl() ); } // random seed
    415416        void ?{}( PRNG & prng, uint32_t seed ) { set_seed( prng, seed ); } // fixed seed
Note: See TracChangeset for help on using the changeset viewer.