mardi 24 février 2015

Python Random Function without using random module

I need to write the function -



random_number(minimum,maximum)


Without using the random module and I did this:



import time

def random_number(minimum,maximum):
now = str(time.clock())
rnd = float(now[::-1][:3:])/1000
return minimum + rnd*(maximum-minimum)


I am not sure this is fine.. is there a known way to do it with the time?





Aucun commentaire:

Enregistrer un commentaire