Answer the question
In order to leave comments, you need to log in
How to write an equation?
You need to convert a random number from 0 to 1 to a number from 25 to 325 and this number must be a multiple of 25.
Answer the question
In order to leave comments, you need to log in
325/25=13;
round((rand()*13))*25;
round(rand()*13) will give integers from 0 to 13.
Multiplying an integer by 25 will give a multiple of 25.
25 is added at the end to get the offset.
Everything is elementary:
print random.choice([i for i in xrange(25, 326, 25)])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question