bunch of stuff, added rand.c