ListData = [
{
id: "list-1",
name: "Shawshank Redemption"
},
{
id: "list-2",
name: "Godfather"
}
]
var ListData = [];
for (let i = 0; i < 101; i++) {
ListData.push({id: `list-${i}`})
}
function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function generate_name(maxlength) {
var s = "";
var simb = 'abcdefghijklmnopqrstuwvxyz';
for (var i = 0; i < maxlength; i++) {
s = s + simb[getRandomIntInclusive(0, simb.length - 1)]
}
return s;
}
function generate_list(maxlimit) {
var arr = [];
for (let i = 1; i <= maxlimit; i++) {
arr.push({
id: "list-"+i,
name: generate_name(getRandomIntInclusive(7, 9)) + " " + generate_name(getRandomIntInclusive(10, 12))
});
}
return arr;
}
console.log( generate_list(100) );