JSFiddle - React, Tailwind, and code Playground

JavaScript

const nums = "0123456789".split("");

function getRandomBetween (min, max) {
  return Math.floor(min + Math.random() * (max - min + 1));
}

function getRandomNumber () {
  const number = [];

  while (nums.length) {
    number.push(nums.splice(getRandomBetween(0, nums.length), 1));
  }

	return +number.join("");
}

document.body.appendChild(document.createTextNode(getRandomNumber()));