September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,13 @@
var pipe=Thread.Pipe(); // used to connect the two threads
fcn{ while(1){ pipe.write((0.0).random(1.0)) } }.launch(); // generator
fcn{ // consumer/calculator
N:=0; M:=SD:=sum:=ssum:=0.0;
while(1){
x:=pipe.read(); N+=1; sum+=x; ssum+=x*x;
M=sum/N; SD=(ssum/N - M*M).sqrt();
if(0==N%100000)
println("N:%,10d mean:%.5f std dev:%.5f".fmt(N,M,SD));
}
}.launch();
Atomic.sleep(60*60); // wait because exiting the VM kills the threads