初涉 Js,想生成一组随机数据,基本的数据格式如下:
var test_data = {
"data": [{
"seq": 36687,
"vol": [63.27994918823242, 63.282066345214844, 63.28112030029297, 63.27827453613281, 63.27593231201172],
"time": "2012-07-18-21-42-13-034",
"hrate": 0,
"status": 0
},{
"seq": 36688,
"vol": [63.24958038330078, 63.249080657958984, 63.25041580200195, 63.25270080566406, 63.254817962646484],
"time": "2012-07-18-21-42-13-072",
"hrate": 0,
"status": 0
}],
};
问题: 我想随机生成 test_data,大概10万行, 纯js代码, seq是自增1,vol为5个随机数字,hrate和status均为0不变,time则是最后3个数字随机变化 (例子中为 42-13-034随机变化)
谢谢!!
循环即可.
随机数的格式自己再造造