Comment faire en sorte que quelque chose engendre sur un axe x aléatoire P5.J

//creates spawn function
function objectSpawn(){
    object.y = 0;
    object.X = random(100, 300);
}

//call this spawn function whenever you want your object to respawn, for example:
if(object.y > 400){
    objectSpawn()
  }
DevDumps.