This file is indexed.

/usr/include/givaro/givrandom.h is in libgivaro-dev 4.0.2-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
// =================================================================== //
// Copyright(c)'1994-2009 by The Givaro group
// This file is part of Givaro.
// Givaro is governed by the CeCILL-B license under French law
// and abiding by the rules of distribution of free software.
// see the COPYRIGHT file for more details.
// Time-stamp: <28 Oct 15 02:59:14 Jean-Guillaume.Dumas@imag.fr>
// =================================================================== //

/*! @file givrandom.h
 * @ingroup system
 * @brief NO DOC
 * @bib
 *   - Fishman, GS <i>Multiplicative congruential random
 * number generators...</i> Math. Comp. 54:331-344 (1990).
 *
 */

#ifndef __GIVARO_random_H
#define __GIVARO_random_H
#include <givaro/givconfig.h>
#include <givaro/udl.h>

extern "C" {
# include <sys/time.h>
# include <sys/resource.h>
}

#define _GIVRAN_MULTIPLYER_ 950706376_ui64
#define _GIVRAN_MODULO_     2147483647_ui64

namespace Givaro {

	//! GivRandom
class GivRandom {
    mutable uint64_t _seed;
public:
    typedef GivRandom random_generator;

    GivRandom(const uint64_t s = 0)
            : _seed(s)
    {
        if (! s) {
		struct timeval tp;
		gettimeofday(&tp, 0) ;
		_seed = (uint64_t)(tp.tv_usec);
	}
    }

    GivRandom(const GivRandom& R) :
	    _seed(R._seed)
	{}

    GivRandom& operator= (const GivRandom& R)
    {
	    _seed = R._seed;
	    return *this;
    }

    uint64_t seed() const
    {
	    return _seed;
    }


    uint64_t max_rand() const
    {   
        return _GIVRAN_MODULO_;
    }
    

// #if defined(__GIVARO_INT64)
#if 1
    uint64_t operator() () const
    {
        return _seed = (uint64_t)(
            (int64_t)_GIVRAN_MULTIPLYER_
            * (int64_t)_seed
            % (int64_t)_GIVRAN_MODULO_ );
    }
#else
    uint64_t operator() () const
    {
        return _seed = (uint64_t)(
            (uint64_t)_GIVRAN_MULTIPLYER_
            * _seed
            % (uint64_t)_GIVRAN_MODULO_ );
    }
#endif

    template<class XXX> XXX& operator() (XXX& x) const
    {
        return x = (XXX)this->operator() ();
    }

};

} // namespace Givaro

#endif // __GIVARO_random_H
// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s