当前位置:网站首页>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 …
边栏推荐
- Oracle triggers and packages
- 611. Number of effective triangles
- Acwing-宠物小精灵之收服-(多维01背包+正序倒序+两种形式dp求答案)
- The mutual realization of C L stack and queue in I
- Altium Designer 19.1.18 - 隐藏某一个网络的飞线
- Play with grpc - go deep into concepts and principles
- What is Bezier curve? How to draw third-order Bezier curve with canvas?
- msys2
- From then on, I understand convolutional neural network (CNN)
- Openxlsx field reading problem
猜你喜欢

Thunderbird tutorial \ easy to use mail client

Oracle triggers and packages

Close of office 365 reading

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

Detailed explanation of miracast Technology (I): Wi Fi display

CADD course learning (5) -- Construction of chemosynthesis structure with known target (ChemDraw)

Altium designer 19.1.18 - clear information generated by measuring distance

MySQL - storage engine

How to modify the file path of Jupiter notebook under miniconda

The printer encountered an abnormal configuration problem 0x8007007e (win10)
随机推荐
Day01 markdown log entry tips
通过sql语句统计特定字段出现次数并排序
RTOS in the development of STM32 single chip microcomputer
Global and Chinese market of digital shore durometer 2022-2028: Research Report on technology, participants, trends, market size and share
Thunderbird tutorial \ easy to use mail client
The number of occurrences of numbers in the offer 56 array (XOR)
Global and Chinese market of rammers 2022-2028: Research Report on technology, participants, trends, market size and share
Calibre garbled
What is deep learning?
. Net service governance flow limiting middleware -fireflysoft RateLimit
Deepin get file (folder) list
About the problem that MySQL connector net cannot be cleared in MySQL
Anaconda pyhton multi version switching
GPIO circuit principle of stm32
Leetcode solution - number of islands
Ue5 hot update - remote server automatic download and version detection (simplehotupdate)
Exit of pyGame, idle and pycharm
Global and Chinese market of peeled bourdon tubes 2022-2028: Research Report on technology, participants, trends, market size and share
cygwin
Basic knowledge of public security -- FB