randInt

taichi_glsl.randgen.randInt(a, b)

Generate a random integer in range [a, b], including both end points.

Parameters
  • a – Specify the start point of range.

  • b – Specify the end point of range.

Returns

The return value is calculated as ti.random(ti.i32) % (b - a) + a.

Note

This means randInt could not fullfill its promise of “distributed evenly” when (b - a) is large (at the scalr of INT_MAX).