Update: The number can be started with zero.
I want to have a function like
function getRandomNumber(n){
...
}
I hope it gets a number with n digits while none of the digits is repeated. For instance:
getRandomNumber(3) -> 152 is what I want.
getRandomNumber(1) -> 6 is what I want.
getRandomNumber(6) -> 021598 is what I want. It can start with zero.
getRandomNumber(5) -> 23156 is what I want.
getRandomNumber(3) -> 252 is not because it has two 2.
getRandomNumber(5) -> 23153 is not because it has two 3.
Any simple way to do this?