what inbuilt function can we use for random number generation? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what inbuilt function can we use for random number generation?

generate random numbers

6th Oct 2017, 2:13 AM
ice prince
ice prince - avatar
10 Answers
+ 2
random.randint(from,to) random.randint(1,10) will automatically select a random integer between 1 and 10.
6th Oct 2017, 2:20 AM
Ankit Agrawal
Ankit Agrawal - avatar
+ 2
inclusive or exclusive of the bounds? and also how do I ensure my input is a number?
6th Oct 2017, 2:38 AM
ice prince
ice prince - avatar
+ 2
copy that, thanks
6th Oct 2017, 2:45 AM
ice prince
ice prince - avatar
+ 2
cool #sayan chandra
6th Oct 2017, 3:20 AM
ice prince
ice prince - avatar
+ 1
so it's between 'from' and 'to -1' huh?
6th Oct 2017, 2:32 AM
ice prince
ice prince - avatar
+ 1
in between "from" and "to"
6th Oct 2017, 2:35 AM
Ankit Agrawal
Ankit Agrawal - avatar
+ 1
inclusive of the bounds
6th Oct 2017, 2:43 AM
Ankit Agrawal
Ankit Agrawal - avatar
0
random.randint(a,b) means a to b random.randrange(a,b) means a to b-1
6th Oct 2017, 3:15 AM
sayan chandra
sayan chandra - avatar
- 1
i think u mistyped the name😐##
6th Oct 2017, 3:19 AM
sayan chandra
sayan chandra - avatar
- 1
😂😂😂😂😂😂
6th Oct 2017, 3:20 AM
sayan chandra
sayan chandra - avatar