summaryrefslogtreecommitdiff
path: root/fun_math/random_walk.py
diff options
context:
space:
mode:
authorzhang <zch921005@126.com>2022-08-21 09:41:53 +0800
committerzhang <zch921005@126.com>2022-08-21 09:41:53 +0800
commit94b6d3246c72eb3cae58a2fd18771e3c2c3e7cb2 (patch)
treee23a287289cdca8020fab062cdebffa60b021d7f /fun_math/random_walk.py
parent756b736ca374dc6ef2adadce101f380e10f06c4e (diff)
copy
Diffstat (limited to 'fun_math/random_walk.py')
-rw-r--r--fun_math/random_walk.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/fun_math/random_walk.py b/fun_math/random_walk.py
new file mode 100644
index 0000000..b425fcb
--- /dev/null
+++ b/fun_math/random_walk.py
@@ -0,0 +1,14 @@
+
+import random
+
+
+# N, S, W, E
+choices = [(0, 1), (0, -1), (-1, 0), (1, 0)]
+
+
+def rand_walk(n, p0=[]):
+ if p0 is None:
+ p0 = [0, 0]
+ pass
+
+