I have created an array of randomly generated images. And 2 of the randomly generated images are to be displayed in an image tag. However, the current issue faced is that the 2 random images displayed in the image tag can be the same images.
How am I able to prevent 2 identical randomly generated image from displaying. Is there another method besides using: .splice(parameter,1);???
var BrandNameArray = ["lib/img/Brands/A.png", "lib/img/Brands/B.png", "lib/img/Brands/C.png", "lib/img/Brands/D.png", "lib/img/Brands/E.png"];
var Brand_list = [];
//Auto populate into brand container once randomised
$('#BrandWinlist > img').each(function(i, img) {
  random_BrandIndex = Math.floor(Math.random() * BrandNameArray.length);
  console.log("random_BrandIndex:" + random_BrandIndex);
  //Assign Variable to generate random Brands
  var Brand = BrandNameArray[random_BrandIndex];
  //BrandNameArray.splice(random_BrandIndex,1);
  Brand_list.push(random_BrandIndex);
  $(img).attr('src', Brand).show();
});<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="GameWinBrand_Container">
  <div id="BrandWinlist" class="GameWinBrand_innerScroll">
    <img id="GameBrand_1" style="width:230px; height:230px; top:0px; left:0px; border:0px; outline:0px" onclick="selectBrand('1');">
    <img id="GameBrand_2" style="width:230px; height:230px; top:0px; left:330px; border:0px;" onclick="selectBrand('2');">
  </div>
</div> 
    