Generates an n-dim matrix of random numbers between upper and lower bounds. Data type specification (integer, single, double) is available.
Al momento, stai seguendo questo contributo
- Vedrai gli aggiornamenti nel tuo feed del contenuto seguito
- Potresti ricevere delle email a seconda delle tue preferenze per le comunicazioni
rand2
Generates an n-dimensional matrix of random numbers between upper and lower bounds. Data type specification (integer, single, double) is available.
Syntax
X = rand2(a,b)
X = rand2(a,b,[],type)
X = rand2(a,b,[n1,...,nn])
X = rand2(a,b,[n1,...,nn],type)
Description
X = rand2(a,b) returns one random double-precision floating-point number X between a and b.
X = rand2(a,b,[],type) returns one random number X of data type type between a and b. Options for type are 'int' (integers), 'single' (single-precision floating point numbers), or 'double' (double-precision floating point numbers).
X = rand2(a,b,[n1,...,nn]) returns an n1-by-n2-by-...-by-nn matrix X of random double-precision floating-point numbers between a and b.
X = rand2(a,b,[n1,...,nn],type) returns an n1-by-n2-by-...-by-nn matrix X of random numbers of data type type. Options for type are 'int' (integers), 'single' (single-precision floating point numbers), or 'double' (double-precision floating point numbers).
Examples
- See "EXAMPLES.mlx" or the "Examples" tab on the File Exchange page for examples.
Cita come
Tamas Kis (2026). Random Number Generator in a Range (rand2) (https://github.com/tamaskis/rand2-MATLAB/releases/tag/v3.1.1), GitHub. Recuperato .
Informazioni generali
Compatibilità della release di MATLAB
- Compatibile con R2008b e release successive
Compatibilità della piattaforma
- Windows
- macOS
- Linux
