aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Lux Programming Language2017-09-23 18:42:37 -0400
committerGitHub2017-09-23 18:42:37 -0400
commit9db66a72aef2bc078b90c23ab219968deed7a5b2 (patch)
tree5484dff7e2b1baa948af6b01f10cde2b94f8eb99
parent7eb6d767daa24d08d609bad83d82985ffb32c762 (diff)
parent2d1bf16691460743f8ea8b19484f1f144653c532 (diff)
Merge pull request #35 from mccraigmccraig/fix-random-tests
swap wasn't swapping
-rw-r--r--stdlib/source/lux/math/random.lux4
1 files changed, 3 insertions, 1 deletions
diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux
index 554dc8a5d..3225f1d6e 100644
--- a/stdlib/source/lux/math/random.lux
+++ b/stdlib/source/lux/math/random.lux
@@ -274,7 +274,9 @@
(def: (swap from to vec)
(All [a] (-> Nat Nat (V;Vector a) (V;Vector a)))
- (V;put to (maybe;assume (V;nth from vec)) vec))
+ (|> vec
+ (V;put to (maybe;assume (V;nth from vec)))
+ (V;put from (maybe;assume (V;nth to vec)))))
(def: #export (shuffle seed vector)
{#;doc "Shuffle a vector randomly based on a seed value."}