Here b contains the integers drawn from a uniform distribution in the range from 1 to 100. This function returns double integers which are drawn from the distribution which is discrete and uniform.
MATLAB RAND GENERATOR
rand(‘state’,k): It sets the generator to its kth state, for any value of k.rand(‘state’,0): It sets the generator to its initial state.rand(‘state’,s): It resets to the state s.We can also change the state of the generator using the below code: Rand(‘state’) returns the current state of the generator.
The graph of this is normally flat since it is drawn from a uniform distribution.
The above example explains that a is a 100 by 1 column vector which contains numbers from a uniform distribution. Rand function is used when the distribution is uniform and always generate real numbers between 0 and 1. Functions in Random Number Generator in Matlabīelow are the function serves a different purpose in MATLAB as listed below: 1. Rand,randn,randi, and randperm are mainly used to create arrays of random values.