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

1 view (last 30 days)
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.

Accepted Answer

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

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!