Last active
May 30, 2018 17:59
-
-
Save joakin/57faea9c6b2b621399a40bd9432194d3 to your computer and use it in GitHub Desktop.
Faker.js user profiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const profiles = 1000; | |
Array(profiles).fill(null).map((_, i) => { | |
const id = i | |
const name = faker.name.findName() | |
let friends = [] | |
while (friends.length < 200) { | |
const friendId = Math.floor(Math.random()*profiles) | |
if (friendId !== id && !friends.includes(friendId)) friends.push(friendId) | |
} | |
return { id, name, friends } | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment