Orthogonal Array Library  1.0.0
Libray for generating orthogonal arrays based on Art Owen's oa library
runif.h
Go to the documentation of this file.
1 
31 #ifndef RUNIF_H
32 #define RUNIF_H
33 
34 #include "OACommonDefines.h"
38 #define SEEDOK 1
39 
42 #define SEEDBAD 0
43 
46 #define SEED_VECTOR_LENGTH (97+1)
47 
48 namespace oacpp
49 {
53  struct SeedSet
54  {
56  SeedSet() {};
58  int is;
60  int js;
62  int ks;
64  int ls;
65  };
66 
76  class RUnif
77  {
78  public:
80  RUnif();
82  RUnif(int is, int js, int ks, int ls);
84  explicit RUnif(SeedSet seedSet);
85 
86  ~RUnif() {};
87 
95  void seed(int is, int js, int ks, int ls );
96 
101  void seed(SeedSet seedSet);
102 
108 
114  void runif(std::vector<double> & x, int n);
115 
122  static int mod(int a, int b);
123 
124  private:
133  static int seedok(int is, int js, int ks, int ls );
134 
140  void ranums(std::vector<double> & x, int n);
141 
142  int m_jent, m_i, m_j, m_k, m_l, ip, jp;
143  std::vector<double> u;
144  double c, cd, cm;
145  };
146 }
147 
148 #endif
oacpp::SeedSet::js
int js
seed j
Definition: runif.h:60
oacpp::RUnif::runif
void runif(std::vector< double > &x, int n)
random uniform number generator
Definition: runif.cpp:126
oacpp::SeedSet::SeedSet
SeedSet()
Constructor.
Definition: runif.h:56
oacpp
Orthogonal Array Namespace.
Definition: ak.h:39
oacpp::SeedSet::ks
int ks
seed k
Definition: runif.h:62
oacpp::RUnif::mod
static int mod(int a, int b)
a mod b
Definition: runif.cpp:67
OACommonDefines.h
oacpp::RUnif::getSeedSet
SeedSet getSeedSet()
Get the seed set.
Definition: runif.cpp:116
oacpp::RUnif
Marsaglia - Zaman universal random number generator.
Definition: runif.h:77
oacpp::RUnif::seed
void seed(int is, int js, int ks, int ls)
sets seed integers, rejects invalid input
Definition: runif.cpp:95
oacpp::SeedSet
A set of seed variables for the random number generator.
Definition: runif.h:54
oacpp::SeedSet::is
int is
seed i
Definition: runif.h:56
oacpp::RUnif::RUnif
RUnif()
Constructor.
Definition: runif.cpp:35
oacpp::SeedSet::ls
int ls
seed l
Definition: runif.h:64