i have to generate a number between -1 and 1 and it being random
i.e
-1 < x < 1
then rand (x)
how do i do this on matlab?
rand() returns a random number between 0 and 1 (with uniform distribution), hence 2*rand()-1 will return a random number between -1 and 1 (uniformly distributed)