+ 1

Is there a way to return random numbers in a certain range without the use of modules...just pure python code?

2nd Feb 2022, 12:53 AM
cryptic blake
cryptic blake - avatar
5 Respuestas
+ 3
You can use random module which comes inbuilt in python
2nd Feb 2022, 2:02 AM
Abu Habban
Abu Habban - avatar
+ 3
Or create a randome number generator from time and date calculation may be but it is not easy.
2nd Feb 2022, 2:03 AM
Abu Habban
Abu Habban - avatar
+ 1
Why should you feel like reinventing the wheel?
2nd Feb 2022, 2:37 AM
Ipang
+ 1
Try out this code. It is a Python translation from my experimental pseudo-random number generator in C. See comment lines for more info. https://code.sololearn.com/cJjrFCp3GiJe/?ref=app
2nd Feb 2022, 7:13 AM
Brian
Brian - avatar
0
Yeah, I don't know any better source for a seed than time. But at least the functions are straight Python. Instead of calling time() you could prompt the user for a seed value.
2nd Feb 2022, 7:28 AM
Brian
Brian - avatar