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,20 @@
define staticarray->swap(p1::integer,p2::integer) => {
fail_if(
#p1 < 1 or #p2 < 1 or
#p1 > .size or #p2 > .size,
'invalid parameters'
)
#p1 == #p2
? return
local(tmp) = .get(#p2)
.get(#p2) = .get(#p1)
.get(#p1) = #tmp
}
define staticarray->knuthShuffle => {
loop(-from=.size, -to=2, -by=-1) => {
.swap(math_random(1, loop_count), loop_count)
}
}
(1 to 10)->asStaticArray->knuthShuffle&asString