Skip to content

Instantly share code, notes, and snippets.

@ryzalyusoff
Last active April 7, 2017 21:57
Show Gist options
  • Save ryzalyusoff/b3d77c220342aea17916c1f0b0b7bab4 to your computer and use it in GitHub Desktop.
Save ryzalyusoff/b3d77c220342aea17916c1f0b0b7bab4 to your computer and use it in GitHub Desktop.
Generate random avatars from Facebook users
<html>
<body>
<script>
function getRandomInt() {
return Math.floor(Math.random() * (10000 - 5)) + 4;
}
for(var i=0; i<100; i++) {
imgUrl = "http://graph.facebook.com/v2.5/" + getRandomInt() + "/picture?height=200&height=200";
elem = document.createElement("img");
elem.setAttribute("src", imgUrl);
elem.setAttribute("width", 200);
elem.setAttribute("height", 200);
document.body.appendChild(elem);
}
</script>
</body>
</html>
<!-- Then can use https://www.mockaroo.com to integrate all the avatar -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment