• 회원가입
  • 로그인
  • 구글아이디로 로그인

[module] Python - random.triangular() 메서드 - 지정 범위 안 가중치 반영 랜덤 부동소수 반환. (= triangular메서드 = 트라이앵귤러)

1593  
목차
  1. random.triangular() 예제 - 지정 범위 안 가중치 반영 랜덤 부동소수
  2. random.triangular() 정의
  3. random.triangular() 구문

 

random.triangular() 예제 - 지정 범위 안 가중치 반영 랜덤 부동소수

예제: 2~6 숫자 중, 3에 근접한 부동소수형 난수 반환.

 

import random

print(random.triangular(2, 6, 3))

 

결과값 예: 2.460275229678044

 

random.triangular() 정의

 

지정 범위 안 부동소수 중 지정 숫자에 근접한 부동소수 반환.

※ mode 매개변수 지정 안 하면, 중간값 기준 (=가중치 부여 X).

 


cf.

random.random() 메서드 : 0~1 사이 부동소수형 난수 반환.

 

 

random.triangular() 구문

 

random.triangular(low=0.0, high=1.0, mode=None)

 


[매개변수]

 

low=0.0

필수. 최저값. (포함 O). (기본값: 0.0)

 

high=1.0

필수. 최대값. (포함 O) (기본값: 1.0)

 

mode=None

선택. row와 high 값 중 더 근접하게 표시할 가중치 숫자.

※ 지정 안 하면, 중간값 기준 (= 가중치 부여 X).

 



분류 제목
module Python - statistics.stdev() 메서드 -
module Python - statistics.pvariance() 메서드 -
module Python - statistics.variance() 메서드 -
module Python - math 모듈 메서드・상수 종류 (※ 수학 모듈)
module Python - math.acos() 메서드 -
module Python - math.acosh() 메서드 -
module Python - math.asin() 메서드 -
module Python - math.asinh() 메서드 -
module Python - math.atan() 메서드 -
module Python - math.atan2() 메서드 -
module Python - math.atanh() 메서드 -
module Python - math.ceil() 메서드 ★ - 천장 반올림 (= 상위 정수로 반올림. = ceil메서드…
module Python - math.comb() 메서드 -
module Python - math.copysign() 메서드 -
module Python - math.cos() 메서드 -
module Python - math.cosh() 메서드 -
module Python - math.degrees() 메서드 -
module Python - math.dist() 메서드 -
module Python - math.erf() 메서드 -
module Python - math.erfc() 메서드 -
3/7
목록
찾아주셔서 감사합니다. Since 2012