Last active
June 3, 2020 21:13
-
-
Save levchenkod/bddfbdc5fb06d9f3d96d45c129519837 to your computer and use it in GitHub Desktop.
Random ava url generator
This file contains hidden or 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 random = (max) => { | |
return Math.floor(Math.random() * max); | |
}; | |
const getRandomAvaURL = () => { | |
const source = 'https://randomuser.me/api/portraits'; | |
const gender = ['women', 'men'][random(2)]; | |
const count = 100; | |
const id = random(count); | |
const extention = 'jpg'; | |
return `${source}/${gender}/${id}.${extention}`; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment