This file is indexed.

/usr/include/crystalspace-2.0/csutil/randomgen.h is in libcrystalspace-dev 2.0+dfsg-1build1.

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
/*
    Copyright (C) 1998-2005 by Jorrit Tyberghein
  
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.
  
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.
  
    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __CS_RNG_H__
#define __CS_RNG_H__

/**\file
 * Random number generator.
 * This random number generator originally appeared in "Toward a Universal
 * Random Number Generator" by George Marsaglia and Arif Zaman.
 * Florida State University Report: FSU-SCRI-87-50 (1987)
 * <p>
 * It was later modified by F. James and published in "A Review of Pseudo-
 * random Number Generators"
 * <p>
 * THIS IS THE BEST KNOWN RANDOM NUMBER GENERATOR AVAILABLE.
 * (However, a newly discovered technique can yield
 * a period of 10^600. But that is still in the development stage.)
 * <p>
 * It passes ALL of the tests for random number generators and has a period
 * of 2^144, is completely portable (gives bit identical results on all
 * machines with at least 24-bit mantissas in the floating point
 * representation).
 * <p>
 * The algorithm is a combination of a Fibonacci sequence (with lags of 97
 * and 33, and operation "subtraction plus one, modulo one") and an
 * "arithmetic sequence" (using subtraction).
 */

#include "csextern.h"
#include "cstypes.h"

/**
 * Portable random number generator class.
 * The reason for using this class if that you may want a
 * consistent random number generator across all platforms
 * supported by Crystal Space. Besides, in general it is a
 * better quality RNG than the one supplied in most C runtime
 * libraries. Personally I observed a significant improvement
 * in a random terrain generator I made after I switched to
 * this RNG.
 */
class CS_CRYSTALSPACE_EXPORT csRandomGen
{
  int i97, j97;
  float u [98];
  float c, cd, cm;

public:
  /// Initialize the random number generator using current time()
  csRandomGen ()
  { Initialize (); }
  /// Initialize the random number generator given a seed
  csRandomGen (uint32 iSeed)
  { Initialize (iSeed); }

  /// Initialize the RNG using current time() as the seed value
  void Initialize ();
  /// Select the random sequence number (942,438,978 sequences available)
  void Initialize (uint32 iSeed);

  /// Get a floating-point random number in range 0 <= num < 1
  float Get ()
  { return RANMAR (); }
  /// Get a uint32 integer random number in range 0 <= num < iLimit
  uint32 Get (uint32 iLimit);

  /// Perform a self-test
  bool SelfTest ();

private:
  /// Initialize the random number generator
  void InitRANMAR (uint32 ij, uint32 kl);
  /// Get the next random number in sequence
  float RANMAR ();
};

#endif // __CS_RNG_H__