当前位置:网站首页>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 …
边栏推荐
- Latex notes
- Altium designer 19.1.18 - hide the fly line of a network
- Apple modify system shortcut key
- CADD course learning (6) -- obtain the existing virtual compound library (drugbank, zinc)
- Temperature sensor DS18B20 principle, with STM32 routine code
- . Net service governance flow limiting middleware -fireflysoft RateLimit
- Batch modify the txt file code to UTF-8 (notepad++)
- Acwing - the collection of pet elves - (multidimensional 01 Backpack + positive and reverse order + two forms of DP for the answer)
- Differences between pycharm and idle and process -- join() in vs Code
- Apple animation optimization
猜你喜欢

Set theory of Discrete Mathematics (I)

Significance and requirements of semiconductor particle control

Latex notes

Use of orbbec Astra depth camera of OBI Zhongguang in ROS melody

Nombre - 1. Création de tableaux

Numpy——1.數組的創建

Opendrive arc drawing script

The number of occurrences of numbers in the offer 56 array (XOR)

Oracle-触发器和程序包

Numpy——1. Creation of array
随机推荐
使用go语言读取txt文件写入excel中
Global and Chinese market of plastic recycling machines 2022-2028: Research Report on technology, participants, trends, market size and share
Apple input method optimization
1089 Insert or Merge 含测试点5
[MySQL] database knowledge record
Altium Designer 19.1.18 - 导入板框
PIL's image tool image reduction and splicing.
Cadence learning records
What is Bezier curve? How to draw third-order Bezier curve with canvas?
Deepin get file (folder) list
Function of static
CADD course learning (6) -- obtain the existing virtual compound library (drugbank, zinc)
Acwing - the collection of pet elves - (multidimensional 01 Backpack + positive and reverse order + two forms of DP for the answer)
Apple script
Day01 markdown log entry tips
Butterfly theme beautification - Page frosted glass effect
Use of orbbec Astra depth camera of OBI Zhongguang in ROS melody
I implement queue with C I
Global and Chinese markets for flexible endoscopic lithotripsy devices 2022-2028: Research Report on technology, participants, trends, market size and share
static的作用