toji / gl-matrix

Javascript Matrix and Vector library for High Performance WebGL apps
glmatrix.net
MIT License
5.4k stars 725 forks source link

random should only return unit vector when scale is undefined #437

Closed marcusround closed 3 years ago

marcusround commented 3 years ago

I encountered unexpected behaviour when passing dynamic values to the scale parameter of vec2.random.

calling random(vec, 0) should return a vector of length 0, not 1.

stefnotch commented 3 years ago

Thank you! I definitely prefer this over the previous behavior