added rand function prototype