mercredi 26 octobre 2016

Generating random integer between negative and positive range in MATLAB

I'm trying to generate a random integer in the range of -2 and 5 using round and rand functions. I'm able to generate a random integer however it always returns a negative value and a zero.

round(rand(1)*-5)




Aucun commentaire:

Enregistrer un commentaire