-
Notifications
You must be signed in to change notification settings - Fork 1
/
dataT.js
21 lines (18 loc) · 814 Bytes
/
dataT.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Define the number of records to generate
const numRecords = 10;
// Define the range of possible values for each field
const names = ["Alice", "Bob", "Charlie", "David", "Eve", "Frank", "Grace", "Heidi", "Ivan", "Judy"];
const ages = Array.from({ length: 100 }, (_, i) => i + 1);
const cities = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix", "Philadelphia", "San Antonio", "San Diego", "Dallas", "San Jose"];
// Generate the random data
const data = [];
for (let i = 0; i < numRecords; i++) {
const record = {
name: names[Math.floor(Math.random() * names.length)],
age: ages[Math.floor(Math.random() * ages.length)],
city: cities[Math.floor(Math.random() * cities.length)]
};
data.push(record);
}
// Output the data as JSON
console.log(JSON.stringify(data));