When I was investigating the project, I found Math.floor(Math.random() * 5) * 90 + 25
and I understand the Math.floor(Math.random().
But why * 5) * 90 + 25?
what do these numbers indicate?
Thanks
// Helper function to return an object containing evenly spaced x and y coordinates:
generateRandomCoords () {
const randomX = Math.floor(Math.random() * 5) * 90 + 25
const randomY = Math.floor(Math.random() * 5) * 100 + 25
return { x: randomX, y: randomY }
}
// Helper function that returns one set of coordinates not in gameState.numCoordinates
assignCoords () {
let assignedCoord = this.generateRandomCoords();
// If the coordinates is already in gameState.numCoordinates, then other set of coordinates are generated until there is one not in use
while (gameState.numCoordinates[`x${assignedCoord.x}y${assignedCoord.y}`]) {
assignedCoord = this.generateRandomCoords()
}
gameState.numCoordinates[`x${assignedCoord.x}y${assignedCoord.y}`] = true
return assignedCoord
}
}