Skip to content

Instantly share code, notes, and snippets.

@joakin
Last active May 30, 2018 17:59
Show Gist options
  • Save joakin/57faea9c6b2b621399a40bd9432194d3 to your computer and use it in GitHub Desktop.
Save joakin/57faea9c6b2b621399a40bd9432194d3 to your computer and use it in GitHub Desktop.
Faker.js user profiles
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