aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test.py
diff options
context:
space:
mode:
authorHsiangNianian <admin@jyunko.cn>2023-04-22 19:51:01 +0800
committerHsiangNianian <admin@jyunko.cn>2023-04-22 19:51:01 +0800
commitdb74ade0234a40c2120ad5f2a41bee50ce13de02 (patch)
tree6f66ffb0fd2b8f27df54569161586c2d8a436b96 /test.py
parent30cde518ee38f63c743c8fe0e90dbad1a93f2cf9 (diff)
downloadHydroRoll-db74ade0234a40c2120ad5f2a41bee50ce13de02.tar.gz
HydroRoll-db74ade0234a40c2120ad5f2a41bee50ce13de02.zip
🤐
Diffstat (limited to 'test.py')
-rw-r--r--test.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test.py b/test.py
new file mode 100644
index 0000000..882ed9a
--- /dev/null
+++ b/test.py
@@ -0,0 +1,18 @@
+import random
+
+# 生成一个随机整数
+num = random.randint(1, 10)
+print(num)
+
+# 从序列中随机选择一个元素
+fruits = ['apple', 'banana', 'orange']
+fruit = random.choice(fruits)
+print(fruit)
+
+# 打乱序列中元素的顺序
+random.shuffle(fruits)
+print(fruits)
+
+# 生成一个 0 到 1 之间的随机小数
+r = random.uniform(1,2)
+print('%.2f' % r)