<script>
function uniqueArray(count, maxNumber) {
if (count > maxNumber) return new Error('count > maxNumber')
const tmp = []
while (count) {
const n = parseInt(Math.random() * maxNumber)
!tmp.includes(n) && (tmp.push(n), count--)
}
return tmp
}
console.log(uniqueArray(10, 100))
console.log(uniqueArray(100, 10))
</script>