aboutsummaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2022-01-01 18:03:36 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2022-01-01 18:03:36 +0100
commit8cd163d433aed8edf41b348e43546bf47c5de197 (patch)
tree047e412aa7e2129882f937e4b4c788bc6696930f /random.c
parent16a9370e7f55eafdbe67dda3c84577d53494258b (diff)
downloaduwu-nolambda-8cd163d433aed8edf41b348e43546bf47c5de197.tar.xz
Update to new uwu syntax
Diffstat (limited to 'random.c')
-rw-r--r--random.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/random.c b/random.c
index c28e139..94c8fb9 100644
--- a/random.c
+++ b/random.c
@@ -7,17 +7,17 @@
UwUVMValue uwu_random(UwUVMArgs *args)
{
- uwuutil_require_exact("random:random", args, 2);
+ uwuutil_require_exact("random.random", args, 2);
UwUVMValue value0 = uwuvm_get_arg(args, 0);
if (value0.type != &uwuint_type)
- error("type error: random:random requires an integer as $0\n");
+ error("type error: random.random requires an integer as $1\n");
UwUVMValue value1 = uwuvm_get_arg(args, 1);
if (value1.type != &uwuint_type)
- error("type error: random:random requires an integer as $1\n");
+ error("type error: random.random requires an integer as $2\n");
long min = uwuint_get(value0);
long max = uwuint_get(value1) + 1;
@@ -25,28 +25,28 @@ UwUVMValue uwu_random(UwUVMArgs *args)
long range = max - min;
if (range < 0)
- error("type error: range passed to random:random is empty\n");
+ error("type error: range passed to random.random is empty\n");
if (range > RAND_MAX)
- error("type error: range passed to random:random is bigger than random:max");
+ error("type error: range passed to random.random is bigger than random.max");
return uwuint_create(min + rand() % range);
}
UwUVMValue uwu_max(UwUVMArgs *args)
{
- uwuutil_require_exact("random:max", args, 0);
+ uwuutil_require_exact("random.max", args, 0);
return uwuint_create(RAND_MAX);
}
UwUVMValue uwu_seed(UwUVMArgs *args)
{
- uwuutil_require_exact("random:seed", args, 1);
+ uwuutil_require_exact("random.seed", args, 1);
UwUVMValue value = uwuvm_get_arg(args, 0);
if (value.type != &uwuint_type)
- error("type error: random:seed requires an integer as $0\n");
+ error("type error: random.seed requires an integer as $1\n");
srand(uwuint_get(value) % RAND_MAX);
return uwunil_create();