|
| 1 | +def randomnum(): |
| 2 | + #importing datetime module |
| 3 | + import datetime #inbuilt module |
| 4 | + time_now = datetime.datetime.now() |
| 5 | + #getting time in terms of microseconds |
| 6 | + random_seed = time_now.microsecond |
| 7 | + # an equation which returns a number between 0 and 10 & takes an integer as a parameter |
| 8 | + seed = random_seed * 8 % 11 |
| 9 | + #making random number somewhat unpredictable !!! |
| 10 | + random_micro_secs = [] |
| 11 | + for i in range(seed): |
| 12 | + random_micro_secs.append(time_now.second**seed) |
| 13 | + seed_2 = sum(random_micro_secs) |
| 14 | + #generating final random number |
| 15 | + truely_random_num=(seed_2 * 8 % 11) |
| 16 | + print(truely_random_num) |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
0 commit comments