Mercurial > forge
changeset 1225:6cfb6c644027 octave-forge
fix bug in save seed/state in rand/randn
author | adb014 |
---|---|
date | Sun, 25 Jan 2004 16:07:40 +0000 |
parents | 018200466763 |
children | 0a883223e111 |
files | FIXES/rand.cc |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/FIXES/rand.cc Sun Jan 25 15:23:11 2004 +0000 +++ b/FIXES/rand.cc Sun Jan 25 16:07:40 2004 +0000 @@ -54,7 +54,7 @@ static Ziggurat randn; static octave_value -do_seed (octave_value_list args, MTRand rng) +do_seed (octave_value_list args, MTRand &rng) { octave_value retval; @@ -96,7 +96,8 @@ rng.seed(n); } else if (tmp.is_matrix_type () - && tmp.rows() == rng.SAVE && tmp.columns() == 1) + && ((tmp.rows() == rng.SAVE && tmp.columns() == 1) || + (tmp.columns() == rng.SAVE && tmp.rows() == 1))) { Array<double> a(tmp.vector_value ()); if (! error_state) @@ -277,7 +278,7 @@ Return a matrix with normally distributed random elements. The\n\ arguments are handled the same as the arguments for @code{rand}.\n\ \n\ -@code{randn} uses a Marsaglia and Tsang[1] Ziggurat technique to +@code{randn} uses a Marsaglia and Tsang[1] Ziggurat technique to\n\ transform from U to N(0,1). The technique uses a 256 level Ziggurat\n\ with the Mersenne Twister from @code{rand} used to generate U.\n\ \n\