17 int64_t s1 = args[0].asInt();
18 int64_t s2 = args[1].asInt();
20 if (s1 <= 0 || s2 <= 0)
22 throw std::runtime_error(
"rand_seed(): Both values must be positive integers");
32 int64_t min = args[0].asInt();
33 int64_t max = args[1].asInt();
37 throw std::runtime_error(
"rand_get(): min value cannot be greater than max value");
static void checkArgCount(const std::vector< Value > &args, size_t minimumArguments, const std::string &name, bool allowMoreArguments=false)
static int64_t rand_next_range(const std::vector< Value > &args, VM *vm)
Get a random number in range.
static void registerRandomFunctions(VM *vm)
static double rand_next_float(const std::vector< Value > &args, VM *vm)
Get a random float (technically a double at a low level).
static Value rand_seed(const std::vector< Value > &args, VM *vm)
Seed the random number generator.
void registerNativeFunction(const std::string &name, NativeFunction fn)
Register a native function.
A value in the Phasor VM.
void PHASORstd_rand_seed(uint64_t s0, uint64_t s1)
double PHASORstd_rand_next_double()
int64_t PHASORstd_rand_next_range(int64_t min, int64_t max)
The Phasor Programming Language and Runtime.