les cuento que estoy terminando de afinar un proyecto y dentro del mismo tengo un generador de numeros al azar realizado en javascript, pero para que quede 10 puntos me guatria que los numeros que genera no se repitan , ya que muchas veces, de los numeros que imprime, alguno se repite, tengo dividido el panel con dos sectores, uno que genera 6 numeros del 0 al 41, y otro que genera 2 numeros del 0 al 9, solo me faltaria el detalle de la no repeticion, a continuacion les muestro el codigo a ver si alguno me puede dar una mano.
//CREATES A FUNCTION THAT CREATES A RANDOM NUMBER AND PUTS IT IN THE CIRCLE
function random(){
//SELECT THE FIVE CIRCLES ON THE PAGE
var one= document.getElementById('one');
var two= document.getElementById('two');
var three= document.getElementById('three');
var four= document.getElementById('four');
var five= document.getElementById('five');
var six= document.getElementById('six');
var seven= document.getElementById('seven');
var eight= document.getElementById('eight');
//CREATE A RANDOM NUMBER FOR EACH OF THE CIRCLES
var a = Math.floor(Math.random()*41);
var b = Math.floor(Math.random()*41);
var c = Math.floor(Math.random()*41);
var d = Math.floor(Math.random()*41);
var e = Math.floor(Math.random()*41);
var f = Math.floor(Math.random()*41);
var g = Math.floor(Math.random()*9);
var h = Math.floor(Math.random()*9);
//PUT RANDOM NUMBERS TO EACH OF THE CIRCLES
one.textContent = a;
two.textContent = b;
three.textContent = c;
four.textContent = d;
five.textContent = e;
six.textContent = f;
seven.textContent = g;
eight.textContent = h;
//THIS ONE IS DIFFERENT BECAUSE THE CIRCLE IS RED
seven.style.color = 'red';
seven.textContent = g;
eight.style.color = 'red';
eight.textContent = h;
}
body{
background: #222;
}
.container{
height: 520px;
width: 340px;
background: #45A5C7;
margin: 60px auto;
padding: 1px 10px;
}
.ball{
margin:1px;
padding: 10px;
float: left;
height: 65px;
width: 65px;
background: white;
border-radius: 30px;
border: 1px solid black;
position: relative;
left: -1%;
text-align: center;
font-size: 2em;
font-weight: bold;
}
.statement , .center{
text-transform: uppercase;
}
.center{
text-align: center;
}
.numbers{
height: 250px;
width: 100%;
position: relative;
top: 30px;
}
button{
position: relative;
left: 50%;
}
#num7{
background: yellow;
}
#num8{
background: yellow;
}
.c{
background: white;
color: black;
}
.state{
clear: both;
float: right;
position: relative;
right: 10%;
top: 1%;
}
.statement{
clear: both;
position: relative;
left: 1%;
top: 5%;
}
#logo{
position: relative;
top: 5%;
}
.center{
position: relative;
top: 40px;
}
button{
position: relative;
bottom: 30px;
left: 45%;
}
.c{
font-size: 2em;
}
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Generar numeros para LotoPlus</title>
</head>
<body>
<div class="container">
<div id="logo">
<div class="ball">L</div>
<div class="ball">a</div>
<div class="ball">R</div>
<div class="ball">e</div>
<div class="ball">a</div>
<div class="ball c">l</div>
</div>
<div class="state">Ag. Oficial 0479</div>
<p class="statement">Perdiste tus números? No sabes cuales jugar? <br>No te preocupes! <br> PowerBall de La Real te Ayuda! <br> Vamos por los MILLONES.</p>
<p class="center">Jugate con estos!</p>
<div class="numbers">
<div class="row">
<div id="num1" class="ball col-md-2"><span id="one"></span></div>
<div id="num2" class="ball col-md-2"><span id="two"></span></div>
<div id="num3" class="ball col-md-2"><span id="three"></span></div>
<div id="num4" class="ball col-md-2"><span id="four"></span></div>
<div id="num5" class="ball col-md-2"><span id="five"></span></div>
<div id="num6" class="ball col-md-2"><span id="six"></span></div>
<div id="num7" class="ball col-md-2"><span id="seven"></span></div>
<div id="num8" class="ball col-md-2"><span id="eight"></span></div>
</div>
</div>
</div>
<button onclick="random()">A GANAR!</button>
</body>
</html>