Random Number without any random function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Random Number without any random function

How can i generate any random number from 0-9 or character a-z without using any pre build random function ???

20th Feb 2019, 8:20 AM
Rishabh Sikarwar
Rishabh Sikarwar - avatar
1 Answer
+ 1
from secrets import token_hex print(token_hex(1)) token_hex() is a Random Number Generator (RNG) you can convert these as you see fit without using the "import random" syntax from time import time time=time() print(str(time)[-1]) generating RNGs based off time is another method
2nd Mar 2019, 1:56 AM
Steven M
Steven M - avatar