Ticket #21579: 21579_givaro_randiter.patch

File 21579_givaro_randiter.patch, 681 bytes (added by cpernet, 3 years ago)

Fix to Givaro randiter

  • src/kernel/system/givrandom.h

    commit 7b26f6aef4f7b84f3879876e74d0c58a54fd5c30
    Author: Clement Pernet <clement.pernet@imag.fr>
    Date:   Wed Sep 28 07:08:56 2016 +0200
    
        Fix bug in seeding the rand generator: tp.tv_usec could be 0 with probability 10^-6, thus causing congruence generator to always output 0.
    
    diff --git a/src/kernel/system/givrandom.h b/src/kernel/system/givrandom.h
    index 1c62f1b..6886931 100755
    a b public: 
    4040    GivRandom(const uint64_t s = 0)
    4141            : _seed(s)
    4242    {
    43         if (! s) {
     43        while (! _seed) {
    4444                struct timeval tp;
    4545                gettimeofday(&tp, 0) ;
    4646                _seed = (uint64_t)(tp.tv_usec);