mercredi 31 août 2016

How create random matrix with values in a specific range?

rand(3,4)

generates the following 3x4 matrix for me:

0.4229    0.4709    0.6385    0.3196
0.0942    0.6959    0.0336    0.5309
0.5985    0.6999    0.0688    0.6544

How can I limit the values generated to a specific range? Like restricting them to values between 1 and 100. And how can I specify whether I want the random numbers to be float or int?




Aucun commentaire:

Enregistrer un commentaire