var x=new Array();
var y=new Array();
var m;
function sample(){
n=0;
m=0;
var timer;
var delay = 10;
var loop = function () {
n=n+1;
if(n>1000)m=0;
if(n>1000)n=1;
x[n]=500*Math.random();
y[n]=500*Math.random();
h=0;
if(x[n]<250)h=h+1;
if(y[n]<250)h=h+1;
if(h==2)m=m+1;
paint();
clearTimeout(timer);
timer = setTimeout(loop, delay);
}
loop();
}
function randx(mu,sig) {
pi = Math.PI;
p1 = 0;
p2 = 0;
x1=Math.random();
x2=Math.random();
f1=Math.log(x1);
r=Math.sqrt(-2*f1)*Math.cos(2 * pi * x2);
p3=mu+sig*r;
return p3;
}
function paint(){
var sub=new svgpaint();
str="<svg width=\"700\" height=\"700\">";
h=0;
if(m>0.24*n)h=h+1;
if(m<0.26*n)h=h+1;
if(h==2)str=str+sub.rect(0,0,500,500,"green");
for(s=1;s<n+1;s++){
str=str+sub.rect(x[s],y[s],2,3,"blue");
h=0;
if(x[s]<250)h=h+1;
if(y[s]<250)h=h+1;
if(h==2)str=str+sub.rect(x[s],y[s],2,3,"red");
}
str=str+"</svg>";
$("#memo").html(str);
}
最終更新:2016年04月22日 01:21