randi: Matrix/Array of Uniform Random Integers

Description Usage Arguments Value See Also Examples

Description

Construct a matrix or multi-way array of uniform random integers.

Usage

1
randi(imax, nrow, ncol = 1, ..., atleast_2d = NULL)

Arguments

imax

A positive integer.

nrow

The desired number of rows.

ncol

The desired number of columns.

...

Further dimensions of the array.

atleast_2d

Logical indicating whether or not to force column vectors to have a second dimension equal to one. Defaults to FALSE. This behavior can also be changed globally using, for example options(atleast_2d = TRUE).

Value

A matrix or array of pseudorandom numbers.

See Also

rand, randn, sample.

Examples

1
randi(2, 5, 5)

Example output

Attaching package: 'ramify'

The following object is masked from 'package:graphics':

    clip

     [,1] [,2] [,3] [,4] [,5]
[1,]    1    1    1    1    2
[2,]    1    2    2    2    1
[3,]    2    1    2    2    2
[4,]    2    1    2    1    2
[5,]    1    2    1    2    2

ramify documentation built on May 2, 2019, 5:58 a.m.