how to use rand function in easy and simple way