Random

namespace tnt

Functions

TNT_API float randomFloat (float min_, float max_)

Get a random float on range [min_,max_].

Return

float

Parameters
  • min_: The minimum value of the float.

  • max_: The maximum value of the float.

TNT_API int randomInt (int min_, int max_)

Get a random int on range [min_,max_].

Return

int

Parameters
  • min_: The minimum value of the int.

  • max_: The maximum value of the int.

TNT_API tnt::Vector randomVector (float minX, float maxX, float minY, float maxY)

Get a tnt::Vector with randomly generated coordinates.

Return

tnt::Vector

Parameters
  • minX: The minimum value of the x coordinate.

  • maxX: The maximum value of the x coordinate.

  • minY: The minimum value of the y coordinate.

  • maxY: The maximum value of the y coordinate.

TNT_API tnt::Vector randomUnitVector ()

Create a randomly generated Vector with magnitude 1.

Return

tnt::Vector

template<std::integral I> TNT_API auto halton1 (I const base, I index) noexcept

Generate a random number using a Halton sequence.

template<std::integral I> TNT_API Vector halton2 (I const baseX, I const baseY, I index) noexcept

Generate a random Vector using Halton sequences.