Programmer Guide/Command Reference/EVAL/rand: Difference between revisions

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====rand=====
Generation of linear distributed pseudo random numbers in the interval <code>-1 <= ''r'' < 1</code>.
----
;Usage 1: '''rand'''
;Result 1: Returns a pseudo random number.
----
;Usage 2: '''<code>rand(''seed'' {, ''nr'' {, ''nc''}})</code>'''
:;''seed'': if this value is not equal ''0'', it is used to initialize the random number generator
:;''nr'': number of rows of the result (default=1)
:;''nc'': number of columns of the result (default=1)
;Result 2: A numeric object ''r'' with ''nr'' rows and ''nc'' columns. Each element of ''r'' is set to a pseudo random number.


{|
;See also: [[Programmer_Guide/Command_Reference/EVAL/grand|grand]], [[Programmer_Guide/Command_Reference/EVAL/sample|sample]], [[Programmer_Guide/Command_Reference/EVAL/shuffle|shuffle]]
|-
|rand
|A linear random number generator in the interval [<nowiki>-</nowiki>1,1[
|-
|rand(seed)
|Like rand, except if seed is >0, it is used to initialise the generator.
|-
|rand(seed, <var>nr</var>, <var>nc</var>)
|Create a vector or a matrix with a linear random number generator with the interval [<nowiki>-</nowiki>1,1[.{|
|-
|<var>seed</var>
|the start value (if > 0)
|-
|nr
|the number of rows or elements (>=1; def.=1)
|-
|nc
|the number of columns (>=1; def.=1)
|}


[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]
|}

Revision as of 15:29, 8 April 2011

Generation of linear distributed pseudo random numbers in the interval -1 <= r < 1.


Usage 1
rand
Result 1
Returns a pseudo random number.

Usage 2
rand(seed {, nr {, nc}})
seed
if this value is not equal 0, it is used to initialize the random number generator
nr
number of rows of the result (default=1)
nc
number of columns of the result (default=1)
Result 2
A numeric object r with nr rows and nc columns. Each element of r is set to a pseudo random number.
See also
grand, sample, shuffle

<function list>

Navigation menu

Personal tools