8 #include "embryo_private.h"
10 /* exported random number api */
13 _embryo_rand_rand(Embryo_Program *ep __UNUSED__, Embryo_Cell *params __UNUSED__)
15 return (Embryo_Cell)(rand() & 0xffff);
19 _embryo_rand_randf(Embryo_Program *ep __UNUSED__, Embryo_Cell *params __UNUSED__)
24 r = (double)(rand() & 0xffff) / 65535.0;
26 return EMBRYO_FLOAT_TO_CELL(f);
29 /* functions used by the rest of embryo */
32 _embryo_rand_init(Embryo_Program *ep)
34 embryo_program_native_call_add(ep, "rand", _embryo_rand_rand);
35 embryo_program_native_call_add(ep, "randf", _embryo_rand_randf);