/usr/include/CLHEP/Random/Random.h is in libclhep-dev 2.1.4.1+dfsg-1.
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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | // $Id: Random.h,v 1.5 2010/06/16 17:24:53 garren Exp $
// -*- C++ -*-
//
// -----------------------------------------------------------------------
// HEP Random
// --- HepRandom ---
// class header file
// -----------------------------------------------------------------------
// This file is part of Geant4 (simulation toolkit for HEP).
//
// It's a singleton instantiated by default within the HEP Random module.
// It uses an instantiated HepJamesRandom engine as default algorithm
// for pseudo-random number generation. HepRandom defines a static private
// data member theGenerator and a set of static inlined methods to manipulate
// it. By means of theGenerator the user can change the underlying engine
// algorithm, get and set the seeds and use any kind of defined random
// distribution.
// Distribution classes inherit from HepRandom and define both static and
// not-static interfaces.
// A static table of uncorrelated seeds is available in this class.
// A static method "getTheTableSeeds()" is defined to access a couple of
// seeds at a given index in the table.
// =======================================================================
// Gabriele Cosmo - Created: 5th Sep 1995
// - Minor update: 17th May 1996
// - Poisson now operates on doubles : 31st Oct 1996
// - Added methods for engine status: 19th Nov 1996
// - Fixed default values to setTheSeed() and
// setTheSeeds() static methods: 16th Oct 1997
// - Modified HepRandom to act as a singleton, constructors
// are kept public for backward compatibility. Added table
// of seeds from HepRandomEngine: 19th Mar 1998
// - Relocated Poisson and Gauss data and simplified
// initialisation of static generator: 5th Jan 1999
// =======================================================================
#ifndef HepRandom_h
#define HepRandom_h 1
#include "CLHEP/Random/defs.h"
#include "CLHEP/Random/RandomEngine.h"
namespace CLHEP {
/**
* @author <Gabriele.Cosmo@cern.ch>
* @ingroup random
*/
class HepRandom {
public:
HepRandom();
HepRandom(long seed);
// Contructors with and without a seed using the default engine
// (JamesRandom).
HepRandom(HepRandomEngine & algorithm);
HepRandom(HepRandomEngine * algorithm);
// Constructor taking an alternative engine as argument. If a pointer is
// given the corresponding object will be deleted by the HepRandom
// destructor.
virtual ~HepRandom();
// Destructor
// implicitly allow compiler-generated copy functions
double flat();
// Returns the flat value ( interval ]0...1[ ).
void flatArray(const int size, double* vect);
// Fills "vect" array of flat random values, given the size.
inline double flat (HepRandomEngine* theNewEngine);
// Returns a flat value, given a defined Random Engine.
inline void flatArray(HepRandomEngine* theNewEngine,
const int size, double* vect);
// Fills "vect" array of flat random values, given the size
// and a defined Random Engine.
virtual double operator()();
// To get a flat random number using the operator ().
virtual std::string name() const;
virtual HepRandomEngine & engine();
virtual std::ostream & put ( std::ostream & os ) const;
virtual std::istream & get ( std::istream & is );
// Save and restore to/from streams
// --------------------------------------------------
// Static member functions using the static generator
// --------------------------------------------------
static void setTheSeed(long seed, int lux=3);
// (Re)Initializes the generator with a seed.
static long getTheSeed();
// Gets the current seed of the current generator.
static void setTheSeeds(const long* seeds, int aux=-1);
// (Re)Initializes the generator with a zero terminated list of seeds.
static const long* getTheSeeds();
// Gets the current array of seeds of the current generator.
static void getTheTableSeeds (long* seeds, int index);
// Gets the array of seeds in the static seedTable at "index" position.
static HepRandom * getTheGenerator();
// Return the current static generator.
static void setTheEngine (HepRandomEngine* theNewEngine);
// To set the underlying algorithm object.
static HepRandomEngine * getTheEngine();
// Returns a pointer to the underlying algorithm object.
static void saveEngineStatus( const char filename[] = "Config.conf" );
// Saves to file the current status of the current engine.
static void restoreEngineStatus( const char filename[] = "Config.conf" );
// Restores a saved status (if any) for the current engine.
static std::ostream& saveFullState ( std::ostream & os );
// Saves to stream the state of the engine and cached data.
static std::istream& restoreFullState ( std::istream & is );
// Restores from stream the state of the engine and cached data.
static std::ostream& saveDistState ( std::ostream & os ) {return os;}
// Saves to stream the state of the cached data.
static std::istream& restoreDistState ( std::istream & is ) {return is;}
// Restores from stream the state of the cached data.
static std::ostream& saveStaticRandomStates ( std::ostream & os );
// Saves to stream the engine and cached data for all distributions.
static std::istream& restoreStaticRandomStates ( std::istream & is );
// Restores from stream the engine and cached data for all distributions.
static void showEngineStatus();
// Dumps the current engine status on screen.
static int createInstance();
// used to initialise the default engine
static std::string distributionName() {return "HepRandomEngine";}
// Provides the name of this distribution class
protected: // -------- Data members ---------
static const long seedTable[215][2];
// Table of seeds
};
std::ostream & operator<< (std::ostream & os, const HepRandom & dist);
std::istream & operator>> (std::istream & is, HepRandom & dist);
} // namespace CLHEP
#ifdef ENABLE_BACKWARDS_COMPATIBILITY
// backwards compatibility will be enabled ONLY in CLHEP 1.9
using namespace CLHEP;
#endif
#include "CLHEP/Random/Random.icc"
#endif
|