aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
authorEduardo Julian2018-12-03 23:35:02 -0400
committerEduardo Julian2018-12-03 23:35:02 -0400
commit7fab6e42fb986b1d66a6ab9cdf822f429224a3d3 (patch)
tree27731ea07b13738b160dd0126c4f18b999b5b283 /stdlib/source
parent3da30aff80bc8c80e090574887a58c6015ceb694 (diff)
Excised contribution relevant to this: https://github.com/LuxLang/lux/pull/35
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux/math/random.lux21
1 files changed, 0 insertions, 21 deletions
diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux
index ffb7bc592..b73e7df02 100644
--- a/stdlib/source/lux/math/random.lux
+++ b/stdlib/source/lux/math/random.lux
@@ -293,24 +293,3 @@
(i64.xor (i64.left-shift 14 s01)))
(i64.rotate-left 36 s01)]))
("lux i64 +" s0 s1)]))
-
-(def: (swap from to vec)
- (All [a] (-> Nat Nat (Row a) (Row a)))
- (|> vec
- (row.put to (maybe.assume (row.nth from vec)))
- (row.put from (maybe.assume (row.nth to vec)))))
-
-(def: #export (shuffle seed row)
- {#.doc "Shuffle a row randomly based on a seed value."}
- (All [a] (-> Nat (Row a) (Row a)))
- (let [_size (row.size row)
- _shuffle (monad.fold Monad<Random>
- (function (_ idx vec)
- (do Monad<Random>
- [rand nat]
- (wrap (swap idx (n/% _size rand) vec))))
- row
- (list.indices _size))]
- (|> _shuffle
- (run (pcg-32 [123 seed]))
- product.right)))