Mercurial > octave
comparison src/DLD-FUNCTIONS/rand.cc @ 9041:853f96e8008f
Cleanup documentation file matrix.texi
Spellcheck
Stylecheck (Mostly double spaces after periods)
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Wed, 25 Mar 2009 08:05:35 -0700 |
parents | eb63fbe60fab |
children | 7c02ec148a3c |
comparison
equal
deleted
inserted
replaced
9040:dbd0c77e575e | 9041:853f96e8008f |
---|---|
351 can be learned after reading 624 consecutive values.\n\ | 351 can be learned after reading 624 consecutive values.\n\ |
352 \n\ | 352 \n\ |
353 Older versions of Octave used a different random number generator.\n\ | 353 Older versions of Octave used a different random number generator.\n\ |
354 The new generator is used by default\n\ | 354 The new generator is used by default\n\ |
355 as it is significantly faster than the old generator, and produces\n\ | 355 as it is significantly faster than the old generator, and produces\n\ |
356 random numbers with a significantly longer cycle time. However, in\n\ | 356 random numbers with a significantly longer cycle time. However, in\n\ |
357 some circumstances it might be desirable to obtain the same random\n\ | 357 some circumstances it might be desirable to obtain the same random\n\ |
358 sequences as used by the old generators. To do this the keyword\n\ | 358 sequences as used by the old generators. To do this the keyword\n\ |
359 \"seed\" is used to specify that the old generators should be use,\n\ | 359 \"seed\" is used to specify that the old generators should be use,\n\ |
360 as in\n\ | 360 as in\n\ |
361 \n\ | 361 \n\ |
362 @example\n\ | 362 @example\n\ |
363 rand (\"seed\", val)\n\ | 363 rand (\"seed\", val)\n\ |
472 @deftypefn {Loadable Function} {} randn (@var{x})\n\ | 472 @deftypefn {Loadable Function} {} randn (@var{x})\n\ |
473 @deftypefnx {Loadable Function} {} randn (@var{n}, @var{m})\n\ | 473 @deftypefnx {Loadable Function} {} randn (@var{n}, @var{m})\n\ |
474 @deftypefnx {Loadable Function} {} randn (\"state\", @var{x})\n\ | 474 @deftypefnx {Loadable Function} {} randn (\"state\", @var{x})\n\ |
475 @deftypefnx {Loadable Function} {} randn (\"seed\", @var{x})\n\ | 475 @deftypefnx {Loadable Function} {} randn (\"seed\", @var{x})\n\ |
476 Return a matrix with normally distributed pseudo-random\n\ | 476 Return a matrix with normally distributed pseudo-random\n\ |
477 elements having zero mean and variance one. The arguments are\n\ | 477 elements having zero mean and variance one. The arguments are\n\ |
478 handled the same as the arguments for @code{rand}.\n\ | 478 handled the same as the arguments for @code{rand}.\n\ |
479 \n\ | 479 \n\ |
480 By default, @code{randn} uses the Marsaglia and Tsang ``Ziggurat technique'' to\n\ | 480 By default, @code{randn} uses the Marsaglia and Tsang ``Ziggurat technique'' to\n\ |
481 transform from a uniform to a normal distribution. (G. Marsaglia and\n\ | 481 transform from a uniform to a normal distribution. (G. Marsaglia and\n\ |
482 W.W. Tsang, @cite{Ziggurat method for generating random variables},\n\ | 482 W.W. Tsang, @cite{Ziggurat method for generating random variables},\n\ |
483 J. Statistical Software, vol 5, 2000,\n\ | 483 J. Statistical Software, vol 5, 2000,\n\ |
484 @url{http://www.jstatsoft.org/v05/i08/})\n\ | 484 @url{http://www.jstatsoft.org/v05/i08/})\n\ |
485 \n\ | 485 \n\ |
486 @seealso{rand, rande, randg, randp}\n\ | 486 @seealso{rand, rande, randg, randp}\n\ |
546 "-*- texinfo -*-\n\ | 546 "-*- texinfo -*-\n\ |
547 @deftypefn {Loadable Function} {} rande (@var{x})\n\ | 547 @deftypefn {Loadable Function} {} rande (@var{x})\n\ |
548 @deftypefnx {Loadable Function} {} rande (@var{n}, @var{m})\n\ | 548 @deftypefnx {Loadable Function} {} rande (@var{n}, @var{m})\n\ |
549 @deftypefnx {Loadable Function} {} rande (\"state\", @var{x})\n\ | 549 @deftypefnx {Loadable Function} {} rande (\"state\", @var{x})\n\ |
550 @deftypefnx {Loadable Function} {} rande (\"seed\", @var{x})\n\ | 550 @deftypefnx {Loadable Function} {} rande (\"seed\", @var{x})\n\ |
551 Return a matrix with exponentially distributed random elements. The\n\ | 551 Return a matrix with exponentially distributed random elements. The\n\ |
552 arguments are handled the same as the arguments for @code{rand}.\n\ | 552 arguments are handled the same as the arguments for @code{rand}.\n\ |
553 \n\ | 553 \n\ |
554 By default, @code{randn} uses the Marsaglia and Tsang ``Ziggurat technique'' to\n\ | 554 By default, @code{randn} uses the Marsaglia and Tsang ``Ziggurat technique'' to\n\ |
555 transform from a uniform to a exponential distribution. (G. Marsaglia and\n\ | 555 transform from a uniform to a exponential distribution. (G. Marsaglia and\n\ |
556 W.W. Tsang, @cite{Ziggurat method for generating random variables},\n\ | 556 W.W. Tsang, @cite{Ziggurat method for generating random variables},\n\ |
557 J. Statistical Software, vol 5, 2000,\n\ | 557 J. Statistical Software, vol 5, 2000,\n\ |
558 @url{http://www.jstatsoft.org/v05/i08/})\n\ | 558 @url{http://www.jstatsoft.org/v05/i08/})\n\ |
559 @seealso{rand, randn, randg, randp}\n\ | 559 @seealso{rand, randn, randg, randp}\n\ |
560 @end deftypefn") | 560 @end deftypefn") |
670 @example\n\ | 670 @example\n\ |
671 r = randp (L / 2)\n\ | 671 r = randp (L / 2)\n\ |
672 r(r > 0) = 2 * randg (r(r > 0))\n\ | 672 r(r > 0) = 2 * randg (r(r > 0))\n\ |
673 r(df > 0) += 2 * randg (df(df > 0)/2)\n\ | 673 r(df > 0) += 2 * randg (df(df > 0)/2)\n\ |
674 @end example\n\ | 674 @end example\n\ |
675 @item @code{Dirichlet (a1, ..., ak)}\n\ | 675 @item @code{Dirichlet (a1, @dots{} ak)}\n\ |
676 @example\n\ | 676 @example\n\ |
677 r = (randg (a1), ..., randg (ak))\n\ | 677 r = (randg (a1), @dots{}, randg (ak))\n\ |
678 r = r / sum (r)\n\ | 678 r = r / sum (r)\n\ |
679 @end example\n\ | 679 @end example\n\ |
680 @end table\n\ | 680 @end table\n\ |
681 @seealso{rand, randn, rande, randp}\n\ | 681 @seealso{rand, randn, rande, randp}\n\ |
682 @end deftypefn") | 682 @end deftypefn") |