23 #if !defined (octave_oct_rand_h)
24 #define octave_oct_rand_h 1
46 static bool instance_ok (
void);
51 return instance_ok () ? instance->do_seed () :
octave_NaN;
55 static void seed (
double s)
58 instance->do_seed (s);
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);
92 return instance_ok () ? instance->do_distribution () : std::string ();
100 instance->do_distribution (d);
106 instance->do_uniform_distribution ();
112 instance->do_normal_distribution ();
118 instance->do_exponential_distribution ();
124 instance->do_poisson_distribution ();
130 instance->do_gamma_distribution ();
136 return instance_ok () ? instance->do_scalar (a) :
octave_NaN;
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);
static void exponential_distribution(void)
static void cleanup_instance(void)
static Array< double > vector(octave_idx_type n, double a=1.0)
static float float_scalar(float a=1.0)
F77_RET_T const double const double double * d
static void seed(double s)
static void state(const ColumnVector &s, const std::string &d=std::string())
static void gamma_distribution(void)
std::map< int, ColumnVector > rand_states
static void poisson_distribution(void)
static ColumnVector state(const std::string &d=std::string())
static NDArray nd_array(const dim_vector &dims, double a=1.0)
static FloatNDArray float_nd_array(const dim_vector &dims, float a=1.0)
static octave_rand * instance
static void normal_distribution(void)
static std::string distribution(void)
static void distribution(const std::string &d)
static double scalar(double a=1.0)
static Array< float > float_vector(octave_idx_type n, float a=1.0)
static void uniform_distribution(void)
static void reset(const std::string &d)