# rand

Version:

Generates uniformly distributed pseudorandom numbers in the interval [0, 1].

## Syntax

rand('seed',s)
c = rand
c = rand(a)
c = rand(a, b)
c = rand(a, b, ...)
c = rand(v)
c = rand(class)
c = rand(a, class)
c = rand(a, b, class)
c = rand(a, b, ..., class)
c = rand(v, class)

## 'seed'

If used, the function generates the same series of pseudorandom numbers.

## a

Number of rows in c. a is a non-negative integer. If a is zero, the function returns an empty array.

## b

Number of columns in c. b is a non-negative integer. If b is zero, the function returns an empty array.

## ...

Further parameters for specifying the number of elements in higher dimensions. You can replace one parameter for any dimension with an empty array, for example, reshapemx([1,2,3,4,5,6], 2, []). The array then is a placeholder for an unspecified size. MathScript uses the array size and the reshape size to calculate the unspecified size automatically.

## s

Seed of the pseudorandom number generator used for the next call of the function.

## v

Vector with number of rows, columns, and further dimensions. v must contain non-negative integer values.

## class

Class of the returned array (optional).

Name Description
'double'

double (default)

'single'

single

## c

Array of uniformly distributed pseudorandom numbers in the interval [0, 1]. If you do not specify b, c returns a square matrix of length a.

## Syntax Details

c = rand generates a single pseudorandom number. c = rand(a, b) is equivalent to c = rand([a, b]).

A = [3, 4]
C = rand(A)

Where This Node Can Run:

Desktop OS: Windows

FPGA: DAQExpress does not support FPGA devices