aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormccraig mccraig of the clan mccraig2017-09-23 10:26:09 +0100
committermccraig mccraig of the clan mccraig2017-09-23 10:26:09 +0100
commit2d1bf16691460743f8ea8b19484f1f144653c532 (patch)
tree5484dff7e2b1baa948af6b01f10cde2b94f8eb99
parent7eb6d767daa24d08d609bad83d82985ffb32c762 (diff)
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."}