Skip to content

Instantly share code, notes, and snippets.

@lightdiscord
Last active April 4, 2018 07:18
Show Gist options
  • Save lightdiscord/43daf68c949faf8d93ab9281c86dfd4a to your computer and use it in GitHub Desktop.
Save lightdiscord/43daf68c949faf8d93ab9281c86dfd4a to your computer and use it in GitHub Desktop.
f(x)=x²
const forms = [
() => {
const limits = [...new Array(2)].map(()=>~~(Math.random()*40)-20)
const symbols = ['<', '≤'].map((v,i,a)=>a[~~(Math.random()*a.length)])
return `${Math.min(...limits)}${symbols[0]}x${symbols[1]}${Math.max(...limits)}`
},
() => {
const symbols = ['<', '≤', '=', '≥', '>']
return `x${symbols[~~(Math.random()*symbols.length)]}${~~(Math.random()*40)-20}`
}
]
const value = forms[~~(Math.random()*forms.length)]
console.log(value())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment