73 F77_FUNC (setcgn, SETCGN) (
const int32_t&);
102 (*current_liboctave_error_handler)
103 (
"unable to create octave_rand object!");
114 union d2i {
double d; int32_t i[2]; };
135 assert (hi > lo && lo >= 0 && hi > lo);
153 union d2i {
double d; int32_t i[2]; };
198 if (old_dist != new_dist)
205 if (old_dist != new_dist)
220 if (old_dist != new_dist)
226 if (old_dist != new_dist)
246 retval =
"exponential";
258 (*current_liboctave_error_handler)
294 (*current_liboctave_error_handler)
295 (
"rand: invalid distribution ID = %d", id);
381 (*current_liboctave_error_handler)
411 (*current_liboctave_error_handler)
430 double dretval = 0.0;
457 if (da <= 0.0 || !
xfinite (a))
464 (*current_liboctave_error_handler)
496 (*current_liboctave_error_handler)
519 (*current_liboctave_error_handler) (
"rand: invalid negative argument");
536 (*current_liboctave_error_handler) (
"rand: invalid negative argument");
583 int hour = tm.
hour () + 1;
584 int minute = tm.
min () + 1;
585 int second = tm.
sec () + 1;
587 int32_t s0 = tm.
mday () * hour * minute * second;
588 int32_t s1 = hour * minute * second;
594 F77_FUNC (setcgn, SETCGN) (stored_distribution);
633 s.
elem (i) =
static_cast<double> (tmp[i]);
649 if (d ==
"uniform" || d ==
"rand")
651 else if (d ==
"normal" || d ==
"randn")
653 else if (d ==
"exponential" || d ==
"rande")
655 else if (d ==
"poisson" || d ==
"randp")
657 else if (d ==
"gamma" || d ==
"randg")
661 (
"rand: invalid distribution '%s'", d.c_str ());
681 d = fmod (d, TWOUP32);
684 u =
static_cast<uint32_t
> (
d);
718 #define MAKE_RAND(len) \
722 for (volatile octave_idx_type i = 0; i < len; i++) \
742 #define RAND_FUNC(x) F77_FUNC (dgenunf, DGENUNF) (0.0, 1.0, x)
753 #define RAND_FUNC(x) F77_FUNC (dgennor, DGENNOR) (0.0, 1.0, x)
764 #define RAND_FUNC(x) F77_FUNC (dgenexp, DGENEXP) (1.0, x)
776 #define RAND_FUNC(x) x = octave_NaN;
784 #define RAND_FUNC(x) F77_FUNC (dignpoi, DIGNPOI) (a, x)
797 #define RAND_FUNC(x) x = octave_NaN;
801 #define RAND_FUNC(x) F77_FUNC (dgengam, DGENGAM) (1.0, a, x)
810 (*current_liboctave_error_handler)
831 #define RAND_FUNC(x) F77_FUNC (dgenunf, DGENUNF) (0.0, 1.0, x)
842 #define RAND_FUNC(x) F77_FUNC (dgennor, DGENNOR) (0.0, 1.0, x)
853 #define RAND_FUNC(x) F77_FUNC (dgenexp, DGENEXP) (1.0, x)
866 #define RAND_FUNC(x) x = octave_NaN;
874 #define RAND_FUNC(x) F77_FUNC (dignpoi, DIGNPOI) (da, x)
887 if (da <= 0.0 || !
xfinite (a))
888 #define RAND_FUNC(x) x = octave_NaN;
892 #define RAND_FUNC(x) F77_FUNC (dgengam, DGENGAM) (1.0, da, x)
901 (*current_liboctave_error_handler)