23 #if !defined (octave_oct_rand_h)
24 #define octave_oct_rand_h 1
46 static bool instance_ok (
void);
49 static double seed (
void)
51 return instance_ok () ? instance->do_seed () :
octave_NaN;
55 static void seed (
double s)
58 instance->do_seed (s);
62 static void reset (
void)
65 instance->do_reset ();
71 return instance_ok () ? instance->do_state (
d) :
ColumnVector ();
76 const std::string&
d = std::string ())
79 instance->do_state (s,
d);
83 static void reset (
const std::string&
d)
86 instance->do_reset (d);
90 static std::string distribution (
void)
92 return instance_ok () ? instance->do_distribution () : std::string ();
97 static void distribution (
const std::string&
d)
100 instance->do_distribution (d);
103 static void uniform_distribution (
void)
106 instance->do_uniform_distribution ();
109 static void normal_distribution (
void)
112 instance->do_normal_distribution ();
115 static void exponential_distribution (
void)
118 instance->do_exponential_distribution ();
121 static void poisson_distribution (
void)
124 instance->do_poisson_distribution ();
127 static void gamma_distribution (
void)
130 instance->do_gamma_distribution ();
136 return instance_ok () ? instance->do_scalar (a) :
octave_NaN;
140 static float float_scalar (
float a = 1.0)
148 return instance_ok () ? instance->do_vector (n, a) :
Array<double> ();
154 return instance_ok () ? instance->do_float_vector (n, a) :
Array<float> ();
161 return instance_ok () ? instance->do_nd_array (dims, a) :
NDArray ();
169 return instance_ok () ? instance->do_float_nd_array (dims, a)
200 double do_seed (
void);
203 void do_seed (
double s);
215 void do_reset (
const std::string&
d);
218 std::string do_distribution (
void);
222 void do_distribution (
const std::string&
d);
224 void do_uniform_distribution (
void);
226 void do_normal_distribution (
void);
228 void do_exponential_distribution (
void);
230 void do_poisson_distribution (
void);
232 void do_gamma_distribution (
void);
235 double do_scalar (
double a = 1.);
238 float do_float_scalar (
float a = 1.);
256 void initialize_ranlib_generators (
void);
258 void initialize_mersenne_twister (
void);
262 void save_state (
void);
264 int get_dist_id (
const std::string&
d);
268 void switch_to_generator (
int dist);