From 2d1bf16691460743f8ea8b19484f1f144653c532 Mon Sep 17 00:00:00 2001 From: mccraig mccraig of the clan mccraig Date: Sat, 23 Sep 2017 10:26:09 +0100 Subject: swap wasn't swapping --- stdlib/source/lux/math/random.lux | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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."} -- cgit v1.2.3