Added @rnd() compile time random function (using the $$rnd() builtin). #2078

This commit is contained in:
Christoffer Lerno
2025-05-15 00:51:33 +02:00
parent 24ebe975d8
commit b83e57b952
7 changed files with 31 additions and 0 deletions

View File

@@ -30,6 +30,14 @@ typedef EmptySlot = void*;
macro @is_empty_macro_slot(#arg) @const @builtin => @typeis(#arg, EmptySlot);
macro @is_valid_macro_slot(#arg) @const @builtin => !@typeis(#arg, EmptySlot);
<*
Returns a random value at compile time.
@ensure return >= 0.0 && return < 1.0
@return "A compile time random"
*>
macro @rnd() @const @builtin => $$rnd();
/*
Use `IteratorResult` when reading the end of an iterator, or accessing a result out of bounds.
*/