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

randint (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

e = randint(a)

e = randint(a, b)

e = randint(a, b, range)

e = randint(a, b, [c d])

e = randint(a, b, range, s)

e = randint(a, b, [c d], s)

Description

Generates uniformly distributed pseudorandom integers in the range you specify. randint uses the same pseudorandom number generator as rand.

Examples

Inputs

Name Description
a Specifies the number of rows in e. a is a positive integer.
b Specifies the number of columns in e. b is a positive integer.
range Specifies the range of pseudorandom integers to generate. range is an integer. If range is positive, LabVIEW generates pseudorandom integers in the interval [0, range-1]. If range is 0, LabVIEW generates integers of 0. If range is negative, LabVIEW generates pseudorandom integers in the interval [range+1, 0]. The default range is 2, and LabVIEW generates pseudorandom integers in the interval [0, 1].
c Specifies the lower bound of the interval of pseudorandom integers to generate. c is an integer.
d Specifies the upper bound of the interval of pseudorandom integers to generate. d is an integer.
s Specifies the seed of the pseudorandom number generator to use.

Outputs

Name Description
e Returns an a-by-b matrix of uniformly distributed pseudorandom integers in the interval you specify. If you do not specify b, e returns a square matrix of length a.

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 = randint(1)
B = randint(3, 4)
C = randint(1, 10, 8)
D = randint(10, 2, [-4, 4])
E = randint(5, 1, 0, 99)
F = randint(3, 4, [-1, 1], 99)

Related Topics

rand
randnormal
random


 

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