CS/Python

[Python] - 랜덤 함수

sliver__ 2022. 12. 13. 21:28
728x90
from random import *

random() # 0.0 ~ 1.0 미만의 임의의 값 생성
random() * 10 # 0.0 ~ 10.0 미만의 임의의 값 생성
int(random() * 10) # 0 ~ 10 미만의 임의의 값 생성
int(random() * 10) + 1 # 1 ~ 10 이하의 임의의 값 생성
randrange(1, 46) # 1 ~ 46 미만의 임의의 값 생성
randint(1, 45) # 1 ~ 45 이하의 임의의 값 생성
728x90