Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

rand (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

Owning Class: statistics

Requires: MathScript RT Module

Syntax

rand('seed')

rand('seed', s)

c = rand

d = rand('seed')

c = rand(a)

c = rand(a, b)

c = rand([a, b])

Description

Generates uniformly distributed pseudorandom numbers in the interval [0, 1]. rand('seed') returns the seed of the pseudorandom number generator. rand('seed', s) sets the seed of the pseudorandom number generator to s. LabVIEW uses this seed to generate a pseudorandom number for the next call to the rand function. c = rand generates a single pseudorandom number. c = rand(a, b) is equivalent to c = rand([a, b]).

Examples

Inputs

Name Description
a Specifies the number of rows in c. a is a positive integer.
b Specifies the number of columns in c. b is a positive integer.
s Specifies the seed of the pseudorandom number generator to use for the next call to the rand function.

Outputs

Name Description
c Returns an a-by-b matrix of uniformly distributed pseudorandom numbers in the interval [0, 1]. If you do not specify b, c returns a square matrix of length a.
d Returns the seed of the pseudorandom number generator.

Details

The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT Not characterized

Examples

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

S = rand('seed')
X = rand(10);
rand('seed', S)
Y = rand(10);

Related Topics

randnormal
random
randpermutation


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit