// setup canvas

const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');

const width = canvas.width = window.innerWidth;
const height = canvas.height = window.innerHeight;

// function to generate random number

function random(min,max) {
  const num = Math.floor(Math.random()*(max-min)) + min;
  return num;
}

// setup canvas

const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');

const width = canvas.width = window.innerWidth;
const height = canvas.height = window.innerHeight;

// function to generate random number

function random(min, max) {
  const num = Math.floor(Math.random() * (max - min + 1)) + min;
  return num;
}

Bring bouncing balls JS in line with tutorial text
Bring bouncing balls JS in line with tutorial text

On https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Object_building_practice, the random function generates a number in [min, max], whereas in the provided main.js file it is [min, max).