Mercurial > hg > octave-lyh
comparison src/DLD-FUNCTIONS/rand.cc @ 9064:7c02ec148a3c
Check grammar on all .cc files
Same check as previously done on .m files
Attempt to enforce some conformity in documentation text for rules
such as two spaces after a period, commas around latin abbreviations, etc.
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Sat, 28 Mar 2009 13:57:22 -0700 |
parents | 853f96e8008f |
children | 610bf90fce2a |
comparison
equal
deleted
inserted
replaced
9063:a6cf0ad87eee | 9064:7c02ec148a3c |
---|---|
322 \n\ | 322 \n\ |
323 @example\n\ | 323 @example\n\ |
324 v = rand (\"state\")\n\ | 324 v = rand (\"state\")\n\ |
325 @end example\n\ | 325 @end example\n\ |
326 \n\ | 326 \n\ |
327 This returns a column vector @var{v} of length 625. Later, you can\n\ | 327 This returns a column vector @var{v} of length 625. Later, you can\n\ |
328 restore the random number generator to the state @var{v}\n\ | 328 restore the random number generator to the state @var{v}\n\ |
329 using the form\n\ | 329 using the form\n\ |
330 \n\ | 330 \n\ |
331 @example\n\ | 331 @example\n\ |
332 rand (\"state\", v)\n\ | 332 rand (\"state\", v)\n\ |
361 \n\ | 361 \n\ |
362 @example\n\ | 362 @example\n\ |
363 rand (\"seed\", val)\n\ | 363 rand (\"seed\", val)\n\ |
364 @end example\n\ | 364 @end example\n\ |
365 \n\ | 365 \n\ |
366 which sets the seed of the generator to @var{val}. The seed of the\n\ | 366 which sets the seed of the generator to @var{val}. The seed of the\n\ |
367 generator can be queried with\n\ | 367 generator can be queried with\n\ |
368 \n\ | 368 \n\ |
369 @example\n\ | 369 @example\n\ |
370 s = rand (\"seed\")\n\ | 370 s = rand (\"seed\")\n\ |
371 @end example\n\ | 371 @end example\n\ |
634 @example\n\ | 634 @example\n\ |
635 r = b * randg (a)\n\ | 635 r = b * randg (a)\n\ |
636 @end example\n\ | 636 @end example\n\ |
637 @item @code{beta (a, b)} for @code{a > -1}, @code{b > -1}\n\ | 637 @item @code{beta (a, b)} for @code{a > -1}, @code{b > -1}\n\ |
638 @example\n\ | 638 @example\n\ |
639 @group\n\ | |
639 r1 = randg (a, 1)\n\ | 640 r1 = randg (a, 1)\n\ |
640 r = r1 / (r1 + randg (b, 1))\n\ | 641 r = r1 / (r1 + randg (b, 1))\n\ |
642 @end group\n\ | |
641 @end example\n\ | 643 @end example\n\ |
642 @item @code{Erlang (a, n)}\n\ | 644 @item @code{Erlang (a, n)}\n\ |
643 @example\n\ | 645 @example\n\ |
644 r = a * randg (n)\n\ | 646 r = a * randg (n)\n\ |
645 @end example\n\ | 647 @end example\n\ |
666 r = randp ((1 - p) / p * randg (n))\n\ | 668 r = randp ((1 - p) / p * randg (n))\n\ |
667 @end example\n\ | 669 @end example\n\ |
668 @item non-central @code{chisq (df, L)}, for @code{df >= 0} and @code{L > 0}\n\ | 670 @item non-central @code{chisq (df, L)}, for @code{df >= 0} and @code{L > 0}\n\ |
669 (use chisq if @code{L = 0})\n\ | 671 (use chisq if @code{L = 0})\n\ |
670 @example\n\ | 672 @example\n\ |
673 @group\n\ | |
671 r = randp (L / 2)\n\ | 674 r = randp (L / 2)\n\ |
672 r(r > 0) = 2 * randg (r(r > 0))\n\ | 675 r(r > 0) = 2 * randg (r(r > 0))\n\ |
673 r(df > 0) += 2 * randg (df(df > 0)/2)\n\ | 676 r(df > 0) += 2 * randg (df(df > 0)/2)\n\ |
677 @end group\n\ | |
674 @end example\n\ | 678 @end example\n\ |
675 @item @code{Dirichlet (a1, @dots{} ak)}\n\ | 679 @item @code{Dirichlet (a1, @dots{} ak)}\n\ |
676 @example\n\ | 680 @example\n\ |
681 @group\n\ | |
677 r = (randg (a1), @dots{}, randg (ak))\n\ | 682 r = (randg (a1), @dots{}, randg (ak))\n\ |
678 r = r / sum (r)\n\ | 683 r = r / sum (r)\n\ |
684 @end group\n\ | |
679 @end example\n\ | 685 @end example\n\ |
680 @end table\n\ | 686 @end table\n\ |
681 @seealso{rand, randn, rande, randp}\n\ | 687 @seealso{rand, randn, rande, randp}\n\ |
682 @end deftypefn") | 688 @end deftypefn") |
683 { | 689 { |
867 "-*- texinfo -*-\n\ | 873 "-*- texinfo -*-\n\ |
868 @deftypefn {Loadable Function} {} randp (@var{l}, @var{x})\n\ | 874 @deftypefn {Loadable Function} {} randp (@var{l}, @var{x})\n\ |
869 @deftypefnx {Loadable Function} {} randp (@var{l}, @var{n}, @var{m})\n\ | 875 @deftypefnx {Loadable Function} {} randp (@var{l}, @var{n}, @var{m})\n\ |
870 @deftypefnx {Loadable Function} {} randp (\"state\", @var{x})\n\ | 876 @deftypefnx {Loadable Function} {} randp (\"state\", @var{x})\n\ |
871 @deftypefnx {Loadable Function} {} randp (\"seed\", @var{x})\n\ | 877 @deftypefnx {Loadable Function} {} randp (\"seed\", @var{x})\n\ |
872 Return a matrix with Poisson distributed random elements with mean value parameter given by the first argument, @var{l}. The arguments\n\ | 878 Return a matrix with Poisson distributed random elements with mean value parameter given by the first argument, @var{l}. The arguments\n\ |
873 are handled the same as the arguments for @code{rand}, except for the\n\ | 879 are handled the same as the arguments for @code{rand}, except for the\n\ |
874 argument @var{l}.\n\ | 880 argument @var{l}.\n\ |
875 \n\ | 881 \n\ |
876 Five different algorithms are used depending on the range of @var{l}\n\ | 882 Five different algorithms are used depending on the range of @var{l}\n\ |
877 and whether or not @var{l} is a scalar or a matrix.\n\ | 883 and whether or not @var{l} is a scalar or a matrix.\n\ |