Darwin Help

Back to Index

Rand

Function Rand


Calling Sequence  Rand()
Return Type  numeric
Synopsis This function returns a random number uniformly distributed between 0 and 1. The random number generator has the seed set by either the function SetRand or SetRandSeed. Any class which is completed with the command CompleteClass will have an automatically generated Rand function, i.e. random objects of the class can be generated. The following table describes the possible arguments of Rand and the object that will be generated.
 

argumentrandom structure

Alignmentrandom alignment
array(t,d1,...)array of dimensions d1,... with entries of type t
Beta(a,b)Beta distributed number with average a/(a+b)
Binomial(n,p)integer binomially distributed, ave n*p, var n*p*(1-p)
Multinomial(n,ps)multinominally distributed integers
ChiSquare(nu)chi-square distributed number with ave nu, var 2*nu
CodingDNA(n)random DNA coding sequence (no stops) with n bases
DNA(n)random DNA sequence with n bases. Uses the global
 vector AF, if suitable
Entrya random entry from the database in DB
Exponential(a,b)exponentially distributed number with ave a+b, var b^2
FDist(nu1,nu2)random F distributed or Variance-ratio number
GammaDist(p)random Gamma distributed number with ave p and var p
Geometric(p)geometrically distributed integer with ave (1-p)/p
Graph(n,m)random graph with n vertices and m edges
integerrandom integer
[t1,t2,...]a list with random components of the given types
LongIntegerrandom extended precision integer
MAlignmentrandom multiple sequence alignment
matrix(t)matrix with random dimensions and random entries of type t
Normal(a,b)normally distributed variable with ave a and var b
MNormal(a,b)multivariate normal with ave vector a and cov matrix b
Poisson(m)Poisson distributed integer with average and variance m
Polarcomplex number in Polar representation
posintrandom positive integer
Protein(n)a random sequence of amino acids of length n
Sequencethe sequence of a random entry from the database in DB
a..bintegers or numbers (depending on type of a,b) in the range
{a,b,...}a random value from the set
Statresults of univariate statistics
stringrandom (readable) string
Student(nu)Student distributed variable with parameter nu
SvdResultresults of an Svd least squares approximation
Treerandom distance tree
a random object of this type
Examples
> SetRand(5);

> Rand();
0.8649
> Rand();
0.6743
> Rand(Normal);
0.6467
> Rand(Binomial(20,0.2));
2
> Rand(Poisson(55));
43
> Rand(Geometric(0.2));
3
> Rand(Exponential(1.2,3));
3.8216
See also Beta_Rand,   Binomial_Rand,   ChiSquare_Rand,   CreateRandSeq,   Cumulative,   Exponential_Rand,   FDist_Rand,   GammaDist_Rand,   Geometric_Rand,   Graph_Rand,   Multinomial_Rand,   Normal_Rand,   Poisson_Rand,   SetRand,   SetRandSeed,   Shuffle,   StatTest,   Std_Score,   Student_Rand,   Zscore