On 21 Jun 2013 07:36, "Arijit Ukil" <arijit.u...@tcs.com> wrote: > > I have following random number generation function > > def rand_int (): > rand_num = int(math.ceil (random.random()*1000)) > return rand_num > > I like to make the value of rand_num (return of rand_int) static/ unchanged after first call even if it is called multiple times. If x= rand_int () returns 45 at the first call, x should retain 45 even in multiple calls. > Pls help. >
Use a variable. _the_num = random.randint(......) def rand_int(): return _the_num
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor