-1

While trying to define random values to a vector, I found that random.random() only gave a number from 0 to 1, and a google search told me nothing more than that. Appreciate the help

  • 5
    You could do `-1 + 2 * random.random()`, in general you can map to any interval with `min_interval + (max_interval - min_interval) * random.random()` – Dani Mesejo Mar 21 '20 at 20:57

1 Answers1

1

you can try this:

import random
random.uniform(-1, 1)
Signor
  • 467
  • 2
  • 8
  • 21