当前位置:网站首页>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 …
边栏推荐
- Global and Chinese markets for medical oxygen machines 2022-2028: Research Report on technology, participants, trends, market size and share
- NSIS search folder
- P3D gauge size problem
- .NET服务治理之限流中间件-FireflySoft.RateLimit
- Self summary of college life - freshman
- II Simple NSIS installation package
- Practical application cases of digital Twins - fans
- Detailed explanation of C language pointer
- Opendrive ramp
- Altium Designer 19.1.18 - 更改铺铜的透明度
猜你喜欢

Idea common settings

Could NOT find XXX (missing: XXX_LIBRARY XXX_DIR)

CADD course learning (6) -- obtain the existing virtual compound library (drugbank, zinc)

Altium designer 19.1.18 - clear information generated by measuring distance

Thunderbird tutorial \ easy to use mail client

Ue5 hot update - remote server automatic download and version detection (simplehotupdate)

Daily Practice:Codeforces Round #794 (Div. 2)(A~D)

Altium designer 19.1.18 - change the transparency of copper laying

II Simple NSIS installation package

大学生活的自我总结-大一
随机推荐
Apple system shortcut key usage
Pagoda create multiple sites with one server
Anaconda pyhton multi version switching
Altium designer 19.1.18 - Import frame
From then on, I understand convolutional neural network (CNN)
MLPerf Training v2.0 榜单发布,在同等GPU配置下百度飞桨性能世界第一
软件设计师:03-数据库系统
Altium Designer 19.1.18 - 隐藏某一个网络的飞线
How to realize audit trail in particle counter software
A series of problems in offline installation of automated test environment (ride)
Apple system optimization
Efficiency difference: the add method used by the set directly and the add method used by the set after judgment
Oracle-触发器和程序包
Global and Chinese market of resistivity meter 2022-2028: Research Report on technology, participants, trends, market size and share
1089 insert or merge, including test point 5
Batch modify the txt file code to UTF-8 (notepad++)
Leetcode solution - number of islands
Apple script
Explanation of parallel search set theory and code implementation
Using C language to realize IIC driver in STM32 development