diff options
Diffstat (limited to 'libraries/embryo/src/lib/embryo_rand.c')
-rw-r--r-- | libraries/embryo/src/lib/embryo_rand.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/libraries/embryo/src/lib/embryo_rand.c b/libraries/embryo/src/lib/embryo_rand.c deleted file mode 100644 index 627f7ed..0000000 --- a/libraries/embryo/src/lib/embryo_rand.c +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "config.h" | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | |||
7 | #include "Embryo.h" | ||
8 | #include "embryo_private.h" | ||
9 | |||
10 | /* exported random number api */ | ||
11 | |||
12 | static Embryo_Cell | ||
13 | _embryo_rand_rand(Embryo_Program *ep __UNUSED__, Embryo_Cell *params __UNUSED__) | ||
14 | { | ||
15 | return (Embryo_Cell)(rand() & 0xffff); | ||
16 | } | ||
17 | |||
18 | static Embryo_Cell | ||
19 | _embryo_rand_randf(Embryo_Program *ep __UNUSED__, Embryo_Cell *params __UNUSED__) | ||
20 | { | ||
21 | double r; | ||
22 | float f; | ||
23 | |||
24 | r = (double)(rand() & 0xffff) / 65535.0; | ||
25 | f = (float)r; | ||
26 | return EMBRYO_FLOAT_TO_CELL(f); | ||
27 | } | ||
28 | |||
29 | /* functions used by the rest of embryo */ | ||
30 | |||
31 | void | ||
32 | _embryo_rand_init(Embryo_Program *ep) | ||
33 | { | ||
34 | embryo_program_native_call_add(ep, "rand", _embryo_rand_rand); | ||
35 | embryo_program_native_call_add(ep, "randf", _embryo_rand_randf); | ||
36 | } | ||