16 #include "internal/mozzi_rand_p.h"
41 inline void randSeed(uint32_t seed) { MozziPrivate::randSeed(seed); };
59 inline void randSeed() { MozziPrivate::MozziRandPrivate::autoSeed(); };
74 inline int8_t
rand(int8_t minval, int8_t maxval)
76 return (int8_t) ((((int) (lowByte(
xorshift96()))) * (maxval-minval))>>8) + minval;
84 inline int8_t
rand(int8_t maxval)
86 return (int8_t) ((((int) (lowByte(
xorshift96()))) * maxval)>>8);
95 inline uint8_t
rand(uint8_t minval, uint8_t maxval)
97 return (uint8_t) ((((
unsigned int) (lowByte(
xorshift96()))) * (maxval-minval))>>8) + minval;
105 inline uint8_t
rand(uint8_t maxval)
107 return (uint8_t) ((((
unsigned int) (lowByte(
xorshift96()))) * maxval)>>8);
118 inline int rand(
int minval,
int maxval)
120 return (
int) ((((
xorshift96() & 0xFFFF) * (maxval-minval))>>16) + minval);
132 return (
int) (((
xorshift96() & 0xFFFF) * maxval)>>16);
141 inline unsigned int rand(
unsigned int minval,
unsigned int maxval)
143 return (
unsigned int) ((((
xorshift96() & 0xFFFF) * (maxval-minval))>>16) + minval);
153 inline unsigned int rand(
unsigned int maxval)
155 return (
unsigned int) (((
xorshift96() & 0xFFFF) * maxval)>>16);
friend uint32_t xorshift96()
Random number generator.
void xorshiftSeed(uint32_t seed)
Initialises Mozzi's (pseudo)random number generator xorshift96() with a chosen seed number.
uint8_t randMidiNote()
Generates a random number in the range for midi notes.
void randSeed(uint32_t seed)
Initialises Mozzi's (pseudo)random number generator xorshift96(), which is used in Mozzi's rand() fun...
uint32_t xorshift96()
Random number generator.
int8_t rand(int8_t minval, int8_t maxval)
Ranged random number generator, faster than Arduino's built-in random function, which is too slow for...