1

I want to use round(random.uniform(1.5, 1.9),2) to generate random number and also use numpy.random.random((5,10)) to generate a list includes 5 elements and every element has 10 items. Can I do them simultaneously?

1 Answer 1

3

Just use numpy.random.uniform() and numpy.round():

numpy.round(numpy.random.uniform(low=1.5, high=1.9, size=(5, 10)), decimals=2)
Sign up to request clarification or add additional context in comments.

3 Comments

Thank you but I want a random number between 1.5 and 1.9 ( I mean between two specific numbers)
Does this answer your question?
Please don't forget to mark an answer as accepted

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.