アットウィキロゴ

おおpp

var point = new Array();
var c = new Array();
 
function sample(){
 
 
for(sx=1;sx<1001;sx++){
r1 = 0;
for(s=1;s<61;s++){
r1=r1+Math.random();
}
point[sx] = r1 - 30;
}
 
 
for (s = 0; s < 61;s++ ){
c[s]=0;    
}
 
for (s = 1; s < 1001;s++ ){
r1=point[s];
sx=Math.floor(r1)+30;
c[sx] = c[sx] + 1;
}
 
maxc = 0;
for (s = 0; s < 61;s++ ){
if(c[s]>maxc)maxc=c[s];    
}
 
 
    paint();
 
}
 
function paint(){
 
var sub=new svgpaint();
 
str="<svg width=\"500\" height=\"500\">";
 
str=str+sub.rect(0,0,500,500,"blue");
for(s=1;s<61;s++){
c1 = 500 * c[s] / maxc;
str=str+sub.rect(s*8,500-c1,8,c1,"red");    
} 
 
str=str+"</svg>";
 
$("#memo").html(str);   
 
}
最終更新:2016年03月04日 03:48