mirror of
https://github.com/python/cpython.git
synced 2025-08-24 10:45:53 +00:00
Revert changes for #13355 by request from Raymond Hettinger
This commit is contained in:
parent
64aafeb4de
commit
b4fd468f12
4 changed files with 1 additions and 45 deletions
|
@ -341,16 +341,6 @@ class Random(_random.Random):
|
|||
http://en.wikipedia.org/wiki/Triangular_distribution
|
||||
|
||||
"""
|
||||
# Sanity check. According to the doc low must be less or equal to
|
||||
# high. And mode should be somewhere between these bounds.
|
||||
if low > high:
|
||||
raise ValueError('high cannot be less then low.')
|
||||
if mode is not None and (mode < low or mode > high):
|
||||
raise ValueError('mode must be between low and high.')
|
||||
|
||||
if high == low:
|
||||
return low
|
||||
|
||||
u = self.random()
|
||||
c = 0.5 if mode is None else (mode - low) / (high - low)
|
||||
if u > c:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue