js/scripts.js
//creates an array of random hex numbers with no repeating values
creates an array of random hex numbers with no repeating values
creates an array of random hex numbers with no repeating values
function randomHex(number){
  let hexArray = [];
  for(let i = 0; i < number; i++){
    let randomColor = Math.floor(Math.random()*16777215).toString(16);
    occurances = numberInArray(hexArray, randomColor);
    while(occurances > 1){
      randomColor = Math.floor(Math.random()*16777215).toString(16);
      occurances = numberInArray(hexArray, randomColor);
    }
    hexArray.push(randomColor);
  }
  const symbolArray = hexArray.map(function(color){
      return "#" + color;
  });
  return symbolArray;
}
function randomHex ( number ) { let hexArray = [ ] ; for ( let i = 0 ; i < number ; i ++ ) { let randomColor = Math . floor ( Math . random ( ) * 16777215 ) . toString ( 16 ) ; occurances = numberInArray ( hexArray , randomColor ) ; while ( occurances > 1 ) { randomColor = Math . floor ( Math . random ( ) * 16777215 ) . toString ( 16 ) ; occurances = numberInArray ( hexArray , randomColor ) ; } hexArray . push ( randomColor ) ; } const symbolArray = hexArray . map ( function ( color ) { return "#" + color ; } ) ; return symbolArray ; }
creates an array of random hex numbers with no repeating values
creates an array of random hex numbers with no repeating values
//let numberInArray = 0; //check if the newest color is already in the array