Python Random randrange() 方法
定義和用法
randrange()
方法從指定範圍中返回一個隨機選擇的元素。
語法
random.randrange(start, stop, step)
引數值
引數 | 描述 |
---|---|
start | 可選。一個整數,指定開始位置。 預設 0 |
停止 | 必需。一個整數,指定結束位置。 |
step | 可選。一個整數,指定增量。 預設 1 |
randrange()
方法從指定範圍中返回一個隨機選擇的元素。
random.randrange(start, stop, step)
引數 | 描述 |
---|---|
start | 可選。一個整數,指定開始位置。 預設 0 |
停止 | 必需。一個整數,指定結束位置。 |
step | 可選。一個整數,指定增量。 預設 1 |
如果您想將 W3Schools 服務用於教育機構、團隊或企業,請傳送電子郵件給我們
sales@w3schools.com
如果您想報告錯誤,或想提出建議,請傳送電子郵件給我們
help@w3schools.com