FastLED 3.9.15
Loading...
Searching...
No Matches

◆ operator()() [3/3]

result_type fl::fl_random::operator() ( result_type n)
inline

Generate a random number in the range [0, n)

Parameters
nThe upper bound (exclusive)
Returns
A random number from 0 to n-1

Definition at line 60 of file random.h.

60 {
61 if (n == 0) return 0;
62 u32 r = next_random32();
63 fl::u64 p = (fl::u64)n * (fl::u64)r;
64 return (u32)(p >> 32);
65 }
u32 next_random32()
Generate next 32-bit random number using this instance's seed.
Definition random.h:34

References next_random32().

+ Here is the call graph for this function: