--- bc/execute.c +++ bc/execute.c @@ -293,7 +293,7 @@ case 'X': /* Random function. */ push_copy (_zero_); - bc_int2num (&ex_stack->s_num, random()); + bc_int2num (&ex_stack->s_num, rand()); break; } break; --- bc/main.c +++ bc/main.c @@ -28,6 +28,7 @@ /* main.c: The main program for bc. */ #include "bcdefs.h" +#include #include #include #include "proto.h" @@ -222,6 +223,9 @@ init_storage(); init_load(); + /* Seed the pseudo-random generator. */ + srand(time(NULL)); + /* Set up interrupts to print a message. */ if (interactive) signal (SIGINT, use_quit);