diff --git a/lib/std/math/math.c3 b/lib/std/math/math.c3 index d8a24644e..6375cbddc 100644 --- a/lib/std/math/math.c3 +++ b/lib/std/math/math.c3 @@ -173,8 +173,8 @@ macro sincos_ref(x, sinp, cosp) } <* -Return a vector with sin / cos of the given angle. - * + Return a vector with sin / cos of the given angle. + @param x `the angle in radians` @require values::@is_int(x) || values::@is_float(x) "Expected an integer or floating point value" *> diff --git a/lib/std/math/math_random.c3 b/lib/std/math/math_random.c3 index c43e7d1e3..b457e407d 100644 --- a/lib/std/math/math_random.c3 +++ b/lib/std/math/math_random.c3 @@ -1,12 +1,12 @@ <* -Randoms: -General usage - -1. Create a Random (see std/math/random for various alternatives), or pick DefaultRandom -2. Define it `DefaultRandom my_random;` -3. Seed it: `random::seed(&my_random, some_seed);` or `rand::seed_entropy(&my_random);` -4. Use it with the functions in random: `float random_float = random::next_float(&my_random);` - * -For just a simple integer between 0 and n (not including n), you can use `rand(n)`. + Randoms: + General usage - + 1. Create a Random (see std/math/random for various alternatives), or pick DefaultRandom + 2. Define it `DefaultRandom my_random;` + 3. Seed it: `random::seed(&my_random, some_seed);` or `rand::seed_entropy(&my_random);` + 4. Use it with the functions in random: `float random_float = random::next_float(&my_random);` + + For just a simple integer between 0 and n (not including n), you can use `rand(n)`. *> module std::math::random; @@ -19,8 +19,8 @@ macro void seed(random, seed) } <* -Seed the random with some best effort entropy. - * + Seed the random with some best effort entropy. + @require is_random(random) *> macro void seed_entropy(random) @@ -29,8 +29,8 @@ macro void seed_entropy(random) } <* -Get the next value between 0 and range (not including range). - * + Get the next value between 0 and range (not including range). + @require is_random(random) @require range > 0 *> @@ -50,8 +50,8 @@ macro int next(random, uint range) } <* -Get a random in the range [min, max], both included. - * + Get a random in the range [min, max], both included. + @require is_random(random) @require max >= min *> @@ -101,8 +101,8 @@ fn double rnd() @builtin } <* -Get 'true' or 'false' - * + Get 'true' or 'false' + @require is_random(random) *> macro bool next_bool(random) @@ -111,8 +111,8 @@ macro bool next_bool(random) } <* -Get a float between 0 and 1.0, not including 1.0. - * + Get a float between 0 and 1.0, not including 1.0. + @require is_random(random) *> macro float next_float(random) @@ -122,8 +122,8 @@ macro float next_float(random) } <* -Get a double between 0 and 1.0, not including 1.0. - * + Get a double between 0 and 1.0, not including 1.0. + @require is_random(random) *> macro double next_double(random)