Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,52 @@
import system'dynamic;
import extensions;
import system'routines;
import system'collections;
extension algorithmOp
{
s_of_n()
{
var counter := new Integer();
var n := self;
^ new ArrayList().mixInto(new
{
eval(i)
{
counter.append:1;
if (__target.Length < n)
{
__target.append:i
}
else
{
if(randomGenerator.nextInt:counter < n)
{ __target[randomGenerator.nextInt:n] := i }
};
^ __target.Value
}
})
}
}
public program()
{
var bin := Array.allocate(10).populate:(n => new Integer());
for(int trial := 0, trial < 10000, trial += 1)
{
var s_of_n := 3.s_of_n();
for(int n := 0, n < 10, n += 1)
{
var sample := s_of_n.eval:n;
if (n == 9)
{ sample.forEach:(i){ bin[i].append:1 } }
}
};
console.printLine:bin.readChar()
}