but the exercise you mention, the randomly generated event happens within the function:

```
const getRandEvent = () => {
const random = Math.floor(Math.random() * 3);
if (random === 0) {
return 'Marathon';
} else if (random === 1) {
return 'Triathlon';
} else if (random === 2) {
return 'Pentathlon';
}
};
```

so each time you call the function, you will get a random event

in your code, you generate the “random” dices once at the start of your program:

```
let dice1 = Math.floor(Math.random()) * 6 + 1;
let dice2 = Math.floor(Math.random()) * 6 + 1;
```

then within your function you return the sum of the dice:

```
const rollTheDice = () => {
// Math.random() gives us a random number from 0 up to, but not including, 1
// We multiplied that by 6 to get a number between 0 and up to, but not including, 6
// But since we actually wanted numbers from 1 to 6, inclusive, we added 1
return dice1 + dice2;
};
```

calling the function multiple times will just use the random values generated at the beginning of your program

what you do, is when you play a dice game, you throw the dice once at the beginning of the game, then each round point to the dice rather then re-rolling them.