Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,105 questions

40,777 answers

573 users

How to use operating systems random number generator in Python

2 Answers

0 votes
import random

rn1 = random.SystemRandom() 
rn2 = random.SystemRandom()

for i in range(7):          
       print('{:04.3f} {:04.3f}'.format(rn1.random(), rn2.random()))




'''
run:

0.155 0.821
0.425 0.917
0.070 0.318
0.905 0.809
0.503 0.459
0.737 0.611
0.668 0.397

'''

 





answered Jun 14, 2019 by avibootz
0 votes
import random
import time

seed = time.time()

rn1 = random.SystemRandom(seed) 
rn2 = random.SystemRandom(seed)

for i in range(7):          
       print('{:04.3f} {:04.3f}'.format(rn1.random(), rn2.random()))




'''
run:

0.908 0.940
0.478 0.642
0.296 0.025
0.782 0.002
0.157 0.650
0.044 0.364
0.217 0.806

'''

 





answered Jun 14, 2019 by avibootz

Related questions

...