jeudi 30 août 2018

How can I generate a range of random floating point numbers in Julia?

I noticed that rand(x) where x is an integer gives me an array of random floating points. I want to know how I can generate an array of random float type variables within a certain range. I tried using a range as follows:

rand(.4:.6, 5, 5)

And I get:

 0.4  0.4  0.4  0.4  0.4
 0.4  0.4  0.4  0.4  0.4
 0.4  0.4  0.4  0.4  0.4
 0.4  0.4  0.4  0.4  0.4
 0.4  0.4  0.4  0.4  0.4

How can I get a range instead of the lowest number in the range?




Aucun commentaire:

Enregistrer un commentaire