Показать сообщение отдельно
  #6 (permalink)  
Старый 13.12.2021, 21:04
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,072

уникальные номера
Boyenerji,
<pre>   <script>
class Symbols {
        constructor(name, count, see) {
                this.name = name;
                this.count = count;
                this.see = see;
        }
}
function randomInteger(min, max)
{
let length = max - min + 1;
let arr = Array.from({length}, (_, i) => min + i);
function shuffle()
{
   arr.forEach((_, i) => {
   let a = Math.trunc(Math.random() * length);
   [arr[i], arr[a]] = [arr[a], arr[i]];
   })
   return arr.slice(0)
}
   let temp = shuffle();
   return _ => {
   temp.length || (temp = shuffle());
   return arr.pop()
   }
}
const count = randomInteger(1, 15);
const hotDog = new Symbols('????', count(), true),
            poganka = new Symbols('????', count(), true),
            hallowen = new Symbols('????', count(), true),
            home = new Symbols('????', count(), true),
            konfeta = new Symbols('????', count(), true),
            sun = new Symbols('????', count(), true);
let arrSimvols = [hotDog, poganka, hallowen, home, konfeta, sun];
 document.write(JSON.stringify(arrSimvols, "", 1))
    </script></pre>
Ответить с цитированием