Ignore:
Timestamp:
Feb 11, 2022, 8:33:38 AM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
5910fc0
Parents:
454b4e0
Message:

formatting, fix bug in set_seed so global_random_state is set

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/stdlib.hfa

    r454b4e0 r6a823241  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jan 15 09:57:28 2022
    13 // Update Count     : 640
     12// Last Modified On : Thu Feb 10 18:34:58 2022
     13// Update Count     : 641
    1414//
    1515
     
    412412void set_seed( PRNG & prng, uint32_t seed_ );
    413413static inline {
    414         uint32_t prng( PRNG & prng ) __attribute__(( warn_unused_result )) with( prng ) { callcnt += 1; return LCG( state ); } // [0,UINT_MAX]
    415414        void ?{}( PRNG & prng ) { set_seed( prng, rdtscl() ); } // random seed
    416415        void ?{}( PRNG & prng, uint32_t seed ) { set_seed( prng, seed ); } // fixed seed
    417416        uint32_t get_seed( PRNG & prng ) __attribute__(( warn_unused_result )) with( prng ) { return seed; } // get seed
     417        uint32_t prng( PRNG & prng ) __attribute__(( warn_unused_result )) with( prng ) { callcnt += 1; return LCG( state ); } // [0,UINT_MAX]
    418418        uint32_t prng( PRNG & prng, uint32_t u ) __attribute__(( warn_unused_result )) { return prng( prng ) % u; } // [0,u)
    419419        uint32_t prng( PRNG & prng, uint32_t l, uint32_t u ) __attribute__(( warn_unused_result )) { return prng( prng, u - l + 1 ) + l; } // [l,u]
Note: See TracChangeset for help on using the changeset viewer.