MCPcopy Create free account
hub / github.com/defold/defold / get_randi

Method get_randi

engine/dlib/src/basis/encoder/cppspmd_math.h:548–557  ·  view source on GitHub ↗

Returns random numbers between [low, high), or low if low >= high

Source from the content-addressed store, hash-verified

546
547// Returns random numbers between [low, high), or low if low >= high
548inline vint spmd_kernel::get_randi(rand_context& x, vint low, vint high)
549{
550 vint rnd = get_randu(x);
551
552 vint range = high - low;
553
554 vint rnd_range = mulhiu(rnd, range);
555
556 return spmd_ternaryi(low < high, low + rnd_range, low);
557}
558
559// Returns random numbers between [low, high), or low if low >= high
560inline vfloat spmd_kernel::get_randf(rand_context& x, vfloat low, vfloat high)

Callers

nothing calls this directly

Calls 2

mulhiuFunction · 0.85
spmd_ternaryiFunction · 0.85

Tested by

no test coverage detected