Skip to content

Commit

Permalink
BUG: Fixes #12. Vector.random_2d() returns negative values.
Browse files Browse the repository at this point in the history
  • Loading branch information
abhikpal committed Sep 21, 2017
1 parent c76c162 commit e78c4a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion p5/pmath/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def from_angle(cls, angle):
def random_2D(cls):
"""Return a random 2D unit vector.
"""
x, y = np.random.random(2)
x, y = 2 * (np.random.random(2) - 0.5)
vec = cls(x, y)
vec.normalize()
return vec
Expand Down

0 comments on commit e78c4a8

Please sign in to comment.