import random
import time
import os


# 유사 난수 값을 백만 번 생성한 후, 성능 측정
random.seed()
prng_t1 = time.monotonic()
for i in range(1, 1000000):
    random.random()

prng_t2 = time.monotonic()

# 암호학적으로 안전한 난수 값을 백만 번 생성한 후, 성능 측정
srng_t1 = time.monotonic()
for i in range(1, 1000000):
    random_four_byte = os.urandom(4)

srng_t2 = time.monotonic()

print("Elapsed time(prng)={0}".format(prng_t2 - prng_t1))
print("Elapsed time(srng)={0}".format(srng_t2 - srng_t1))
3f7ea3c61519392be2400bd384e79c1dff0a48ef
<mask token>

<mask token>
random.seed()
<mask token>
for i in range(1, 1000000):
    random.random()
<mask token>
for i in range(1, 1000000):
    random_four_byte = os.urandom(4)
<mask token>
print('Elapsed time(prng)={0}'.format(prng_t2 - prng_t1))
print('Elapsed time(srng)={0}'.format(srng_t2 - srng_t1))

<mask token>
random.seed()
prng_t1 = time.monotonic()
for i in range(1, 1000000):
    random.random()
prng_t2 = time.monotonic()
srng_t1 = time.monotonic()
for i in range(1, 1000000):
    random_four_byte = os.urandom(4)
srng_t2 = time.monotonic()
print('Elapsed time(prng)={0}'.format(prng_t2 - prng_t1))
print('Elapsed time(srng)={0}'.format(srng_t2 - srng_t1))

import random
import time
import os
random.seed()
prng_t1 = time.monotonic()
for i in range(1, 1000000):
    random.random()
prng_t2 = time.monotonic()
srng_t1 = time.monotonic()
for i in range(1, 1000000):
    random_four_byte = os.urandom(4)
srng_t2 = time.monotonic()
print('Elapsed time(prng)={0}'.format(prng_t2 - prng_t1))
print('Elapsed time(srng)={0}'.format(srng_t2 - srng_t1))

import random
import time
import os


# 유사 난수 값을 백만 번 생성한 후, 성능 측정
random.seed()
prng_t1 = time.monotonic()
for i in range(1, 1000000):
    random.random()

prng_t2 = time.monotonic()

# 암호학적으로 안전한 난수 값을 백만 번 생성한 후, 성능 측정
srng_t1 = time.monotonic()
for i in range(1, 1000000):
    random_four_byte = os.urandom(4)

srng_t2 = time.monotonic()

print("Elapsed time(prng)={0}".format(prng_t2 - prng_t1))
print("Elapsed time(srng)={0}".format(srng_t2 - srng_t1))