randUnit2D

taichi_glsl.randgen.randUnit2D()

Generate a 2-D random unit vector whose length is equal to 1.0. The return value is a 2-D vector, whose tip distributed evenly on the border of a unit circle.

Returns

The return value is computed as:

a = rand() * math.tau
return vec(ti.cos(a), ti.sin(a))