diff options
Diffstat (limited to 'std')
| -rw-r--r-- | std/stdlib.c | 2 | ||||
| -rw-r--r-- | std/stdlib.sloth | 2 | ||||
| -rw-r--r-- | std/stdmath.c | 6 |
3 files changed, 7 insertions, 3 deletions
diff --git a/std/stdlib.c b/std/stdlib.c index 11ae42f..f405b6f 100644 --- a/std/stdlib.c +++ b/std/stdlib.c @@ -2,7 +2,7 @@ #include <stdlib.h> #include <string.h> -void wait(int x) { +void wait(float x) { sleep(x); } diff --git a/std/stdlib.sloth b/std/stdlib.sloth index cc404f6..e15d4dc 100644 --- a/std/stdlib.sloth +++ b/std/stdlib.sloth @@ -1,4 +1,4 @@ -foreign fn wait(x: Int) Void; +foreign fn wait(x: Float) Void; foreign fn print(str: String) Void; foreign fn slen(str: String) Int; # foreign fn charAt(str: String) Char; diff --git a/std/stdmath.c b/std/stdmath.c index 37c81b0..f7f79c6 100644 --- a/std/stdmath.c +++ b/std/stdmath.c @@ -2,8 +2,12 @@ #include <stdlib.h> #include <time.h> +bool random_setup = false; int randGen(int min, int max) { - srandom((unsigned) time(NULL)); + if random_setup == false { + srandom(time(NULL)); + random_setup = true; + } return random() % (max - min + 1) + min; } |
