Skip to content

Instantly share code, notes, and snippets.

@vinicius73
Created June 7, 2017 21:13
Show Gist options
  • Save vinicius73/dcca3177e4c3eb672cf001c135951aae to your computer and use it in GitHub Desktop.
Save vinicius73/dcca3177e4c3eb672cf001c135951aae to your computer and use it in GitHub Desktop.
const dic = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
const randomInt = (max = 1000, min = 0) => Math.floor(Math.random() * (max - min)) + min
const randomString = () => dic.charAt(randomInt(dic.length -1, 0))
const makeArray = (length, cb) => Array.from({ length }, cb)
const makeArrayOfStrings = length => makeArray(length, randomString)
const joiArr = lists => lists
.reduce((acc, arr) => {
return `${acc}${arr.join('')}`
}, '')
const makeLists = length => makeArray(length, () => makeArrayOfStrings(randomInt(10, 3)))
const st = joiArr(makeLists(2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment