in rand.c,added more functions