%{ #include "wisebase.h" #include %} %{ #include "wiserandom.h" static boolean isinit = FALSE; %func initates the random generator to time byte... %% void init_random(void) { srand48((long) time(NULL)); isinit = TRUE; } %func returns an integer between 0 and l though I don't think we will get 0 very often. Hmmm. %% int random_integer(int l) { double rand; rand = random_0_to_1(); return (int) (l*rand); } %func returns a random number between 0 and 1 %% double random_0_to_1(void) { double ret; if( isinit == FALSE) init_random(); isinit = TRUE; ret = drand48(); return ret; }