Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,21 @@
import "random" for Random
var rand = Random.new()
var knuthShuffle = Fn.new { |a|
var i = a.count - 1
while (i >= 1) {
var j = rand.int(i + 1)
var t = a[i]
a[i] = a[j]
a[j] = t
i = i - 1
}
}
var tests = [ [], [10], [10, 20], [10, 20, 30] ]
for (a in tests) {
var b = a.toList // store original order
knuthShuffle.call(a)
System.print("%(b) -> %(a)")
}