# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# rand

Class: qrandstream

Generate quasi-random points from stream

## Syntax

```rand rand(q,n) rand(q) rand(q,m,n) rand(q,[m,n]) rand(q,m,n,p,...) rand(q,[m,n,p,...]) ```

## Description

`rand` returns a matrix of quasi-random values and is intended to allow objects of the `qrandstream` class to be used in code that contains calls to the `rand` method of the MATLAB® pseudo-random `randstream` class. Due to the multidimensional nature of quasi-random numbers, only some syntaxes of `rand` are supported by the `qrandstream` class.

`rand(q,n)` returns an `n`-by-`n` matrix only when `n` is equal to the number of dimensions. Any other value of `n` produces an error.

`rand(q)` returns a scalar only when the stream is in one dimension. Having more than one dimension in `q` produces an error.

`rand(q,m,n)` or `rand(q,[m,n])` returns an `m`-by-`n` matrix only when `n` is equal to the number of dimensions in the stream. Any other value of `n` produces an error.

`rand(q,m,n,p,...)` or `rand(q,[m,n,p,...])` produces an error unless `p` and all following dimensions sizes are equal to one.

## Examples

Generate the first 256 points from a 5-D Sobol sequence:

```q = qrandstream('sobol',5); X = rand(q,256,5);```