We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c8928c2 commit 23bc7b9Copy full SHA for 23bc7b9
python-standard-library/generating-random-data/generate.py
@@ -3,6 +3,8 @@
3
import string
4
import secrets
5
6
+import numpy as np
7
+
8
# generate random integer between a and b (including a and b)
9
randint = random.randint(1, 500)
10
print("randint:", randint)
@@ -19,6 +21,14 @@
19
21
choices = random.choices(range(1000), k=5)
20
22
print("choices:", choices)
23
24
+# get a random vector of size 20
25
+vector = np.random.random((30,))
26
+print("vector:\n", vector)
27
28
+# get a random matrix of size (3, 3) in the range [0, 100]
29
+matrix = np.random.random((3, 3)) * 100
30
+print("matrix:\n", matrix)
31
32
# generate a random floating point number from 0.0 <= x <= 1.0
33
randfloat = random.random()
34
print("randfloat between 0.0 and 1.0:", randfloat)
0 commit comments