From 7b7e02976d08e61b6bd43c6dc2880802163fd704 Mon Sep 17 00:00:00 2001 From: koniifer Date: Sat, 23 Nov 2024 18:06:48 +0000 Subject: [PATCH] random change --- sysdata/libraries/stn/src/random.hb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sysdata/libraries/stn/src/random.hb b/sysdata/libraries/stn/src/random.hb index a7e5ec29..bf2917ca 100644 --- a/sysdata/libraries/stn/src/random.hb +++ b/sysdata/libraries/stn/src/random.hb @@ -1,7 +1,15 @@ -any := fn($Expr: type): Expr { +$any := fn($Expr: type): Expr { return *@eca(3, 4, &@as(Expr, idk), @sizeof(Expr)) } -range := fn($Expr: type, min: Expr, max: Expr): Expr { +$range := fn($Expr: type, min: Expr, max: Expr): Expr { return *@eca(3, 4, &@as(Expr, idk), @sizeof(Expr)) % (max - min) + *@bitcast(&1) + min +} + +$fill := fn($Expr: type, ptr: ^Expr): void { + return @eca(3, 4, ptr, @sizeof(Expr)) +} + +$fill_buffer := fn(buf: ^u8, len: uint): void { + return @eca(3, 4, buf, len) } \ No newline at end of file