程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Cloud Computing Development: detailed explanation of python3 random number function uniform() method

編輯:Python

describe

Python3 uniform() Method will randomly generate the next real number , It's in [x,y] Within the scope of .

grammar

Here are uniform() The grammar of the method :

import random

random.uniform(x, y)

Be careful :uniform() It's not directly accessible , Import required random modular , And then through random Static objects call the method .

Parameters

x -- The minimum of a random number , Contains the value .

y -- The maximum of random numbers , Contains the value .

Return value

Returns a floating point number N, The value range is if x<y be x <= N <= y, If y<x be y <= N <= x.

example

Here's how to use uniform() Examples of methods :

The output of the above example is :


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved