Random Vec2 and Vec3

It would be nice (and easy to implement) to have a method to generate a random Vec2 or Vec3. I’m thinking that these two methods could be added to the existing pc.math.random or just along with it.


or just


There is also the possibility to add it directly on the Vec2 and Vec3 classes.


All these would beat having to do:

new Vec3(pc.math.random(0,1), pc.math.random(0,1), pc.math.random(0,1))

Developers tend to monkey patch extra functions to the existing API if they feel like something is missing. You can also submit a pull request which increases the likelihood that it will be integrated into the engine :slight_smile:

1 Like