当前位置:网站首页>Random function usage notes
Random function usage notes
2022-07-05 07:47:00 【Fall in love with wx】
1. Import random modular
import random
2. Generate (n, m) Random integer between
>>> import random
>>> a = random.randint(1, 10) #1<=a<=10 And n,m Size must be n<m
>>> print(a)
3
>>>
3. take 0-1 Between random floating-point numbers
>>> import random
>>> a = random.random()
>>> print(a)
0.7513964072198035 # Default 15-16 digit
>>>
4. Generate (n, m) Is a random floating point number
>>> import random
>>> a = random.uniform(1, 3)
>>> print(a)
1.750766501474142
>>> a = random.uniform(3, 1) #n,m The size can be reversed
>>> print(a)
2.067256580652267
>>>
5. Generate (n, m) Is a random floating point number , The decimal point is x position
>>> import random
>>> a = random.uniform(1, 10)
>>> b = round(a, 2) #x=2
>>> print(b)
4.55
>>>
To be updated …
边栏推荐
- Day08 ternary operator extension operator character connector symbol priority
- Altium designer 19.1.18 - Import frame
- Esmini longspeedaction modification
- What is Bezier curve? How to draw third-order Bezier curve with canvas?
- Apple animation optimization
- String alignment method, self use, synthesis, newrlcjust
- Web page Chinese display (print, etc.) GBK error, solution, software
- ·Practical website·
- Opendrive arc drawing script
- Apple input method optimization
猜你喜欢

Numpy——1.數組的創建

Package ‘*****‘ has no installation candidate

Altium Designer 19.1.18 - 更改铺铜的透明度

MySql——存储引擎

From then on, I understand convolutional neural network (CNN)

万字详解八大排序 必读(代码+动图演示)

A complete set of indicators for the 10000 class clean room of electronic semiconductors

About the problem that MySQL connector net cannot be cleared in MySQL

Set theory of Discrete Mathematics (I)

Opendrive arc drawing script
随机推荐
[MySQL] database knowledge record
Detailed explanation of C language pointer
使用go语言读取txt文件写入excel中
Global and Chinese markets for flexible endoscopic lithotripsy devices 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of urban rail connectors 2022-2028: Research Report on technology, participants, trends, market size and share
[neo4j] common operations of neo4j cypher and py2neo
What is deep learning?
MySQL - storage engine
Day09 how to create packages import package naming conventions Alibaba Development Manual
Nombre - 1. Création de tableaux
The browser cannot access Baidu
Selenium element positioning
MySql——存储引擎
A series of problems in offline installation of automated test environment (ride)
[popular science] some interesting things that I don't know whether they are useful or not
assert_ Usage of param function
Pit record of Chmod 2 options in deepin
IC software learning
P3D gauge size problem
数字孪生实际应用案例-风机篇