src/components/CharacterSelection.js
/**
   * Randomizes the username, icon, icon color and background color and send the new data to App.js
   */
Randomizes the username, icon, icon color and background color and send the new data to App.js
Randomizes the username icon icon color and background color and send the new data to App . js
randomize() {
    const randomIconNumber = randomIntFromInterval(iconData.length);
    const randomIconColor = randomIntFromInterval(Colors.length);
    const username = getRandomName();
    let randomBackgroundColor = randomIntFromInterval(Colors.length);
    while (randomIconColor === randomBackgroundColor) {
      randomBackgroundColor = randomIntFromInterval(Colors.length);
    }
    const iconColor = Colors[randomIconColor].hex;
    const backgroundColor = Colors[randomBackgroundColor].hex;
    const currentIconID = iconData[randomIconNumber].id;
    this.setState({
      username,
      iconColor,
      backgroundColor,
      currentIconID,
    });
  }
randomize ( ) { const randomIconNumber = randomIntFromInterval ( iconData . length ) ; const randomIconColor = randomIntFromInterval ( Colors . length ) ; const username = getRandomName ( ) ; let randomBackgroundColor = randomIntFromInterval ( Colors . length ) ; while ( randomIconColor === randomBackgroundColor ) { randomBackgroundColor = randomIntFromInterval ( Colors . length ) ; } const iconColor = Colors [ randomIconColor ] . hex ; const backgroundColor = Colors [ randomBackgroundColor ] . hex ; const currentIconID = iconData [ randomIconNumber ] . id ; this . setState ( { username , iconColor , backgroundColor , currentIconID , } ) ; }
Randomizes the username, icon, icon color and background color and send the new data to App.js
Randomizes the username icon icon color and background color and send the new data to App . js