generate random number which in a range from 0 to Max