ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MixMaxEngine.cxx
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Authors: L. Moneta 8/2015
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2015 , ROOT MathLib Team *
7  * *
8  * *
9  **********************************************************************/
10 
11 // implementation file of MixMax engine
12 //
13 //
14 // Created by: Lorenzo Moneta : Tue 4 Aug 2015
15 //
16 //
17 #include "Math/MixMaxEngine.h"
18 
19 #include "mixmax.h"
20 
21 
22 namespace ROOT {
23 namespace Math {
24 
25  MixMaxEngine::MixMaxEngine(uint64_t seed) {
26  fRngState = rng_alloc();
27  SetSeed64(seed);
28  }
29 
32  }
33 
34 
35  // void MixMaxEngine::SeedUniqueStream(unsigned int clusterID, unsigned int machineID, unsigned int runID, unsigned int streamID) {
36  // seed_uniquestream(fRngState, clusterID, machineID, runID, streamID);
37  // }
38 
39  void MixMaxEngine::SetSeed(unsigned int seed) {
40  seed_spbox(fRngState, seed);
42  }
43 
44  void MixMaxEngine::SetSeed64(uint64_t seed) {
45  seed_spbox(fRngState, seed);
47  }
48 
49  // unsigned int MixMaxEngine::GetSeed() const {
50  // return get_next(fRngState);
51  // }
52 
53 
54  // generate one random number in interval ]0,1]
56  return get_next_float(fRngState);
57  }
58 
59  // generate one integer number
60  uint64_t MixMaxEngine::IntRndm() {
61  return get_next(fRngState);
62  }
63 
64 
65  void MixMaxEngine::RndmArray(int n, double *array){
66  // Return an array of n random numbers uniformly distributed in ]0,1]
67  fill_array(fRngState, n, array);
68  }
69 
70 
71 
72 
73 
74  } // namespace Math
75 } // namespace ROOT
int rng_free(rng_state_t *X)
Definition: mixmax.cxx:186
rng_state_t * rng_alloc()
Definition: mixmax.cxx:178
double get_next_float(rng_state_t *X)
Definition: mixmax.cxx:97
void SetSeed64(uint64_t seed)
set the generator seed using a 64 bits integer
void SetSeed(unsigned int seed)
set the generator seed
myuint get_next(rng_state_t *X)
Definition: mixmax.cxx:83
void RndmArray(int n, double *array)
generate an array of random numbers
void seed_spbox(rng_state_t *X, myuint seed)
Definition: mixmax.cxx:229
uint64_t IntRndm()
generate a 64 bit integer number
double Rndm_impl()
implementation function to generrate the random number
MixMaxEngine(uint64_t seed=1)
rng_state_t * fRngState
Definition: MixMaxEngine.h:88
int iterate(rng_state_t *X)
Definition: mixmax.cxx:40
const Int_t n
Definition: legend1.C:16
void fill_array(rng_state_t *X, unsigned int n, double *array)
Definition: mixmax.cxx:117