var score= new Array();
var num1=d3.range(6).map(d3.random.normal(0.8,0.1));
// 隨機生成年級
var grades=[1,2,3,4];
// 隨機生成班級
var classes=[1,2];
//隨機生成姓
var lastnames=["趙","錢","孫","李","周","吳","鄭","王","馮","陳","衛","蔣","沈","韓","楊","朱","秦","許","何","呂","施","張"];
//隨機生成名
var firstnames=["偉","芳","娜","麗","強","靜","敏","磊","軍","濤","明","剛","潔","斕","文","華","金","斌","波","輝","亮","超"];
2、構造函數
function getStu(){
var stu = {
"name":"",
"detail":{}
};
var lastname=lastnames[Math.floor(Math.random()*lastnames.length+1)-1];
var firstname=firstnames[Math.floor(Math.random()*firstnames.length+1)-1];
var grade=Math.floor(Math.random()*4+1);
var classe=Math.floor(Math.random()*2+1);
stu.name = lastname+firstname;
stu.detail.grade = grade;
stu.detail.class = classe;
stu.detail.score = num1.map(function(d){
return d*100>100?100:Math.round(d*100);
});
return stu;
}