MATLAB: Find a command that will generate a pseudo-random number(random number) that lies bwtween -1 and 1 drawn from uniform distribution

random number generator

Hi I am trying to find a command that will generate a pseudo-random number(random number) that lies between -1 and 1 drawn from uniform distribution.

Best Answer

You haven't looked very far, rand is what you want:
n = 2 * rand(1, 1000) - 1; %generate 1000 numbers between -1 and 1