ported rand_nums to spice2