Hey guys I am very new to coding. I would like to have rocks appear at random locations each time I reset the game, and I am also confused with the code I am writing. I was just messing around with it till it worked but I'm not exactly sure what I did. For example (myRock9, 9,Greenfoot.getRandomNumber(11)) so obviously its rock9, but then I put another random number (9) and I don't know what its supposed to be but without it, the code doesn't work. And then the 11 is I guess the number that I am pulling the random number from? so it means I'm getting a random number out of 10? And is there a faster way to maybe do this?
public WombatWorld()
{
super(10, 10, 60);
setBackground("cell.jpg");
setPaintOrder(Wombat.class, Leaf.class);
Wombat myWombat = new Wombat();
addObject(myWombat, 2,2);
Rock myRock = new Rock();
addObject(myRock, 1,Greenfoot.getRandomNumber(11));
Rock myRock2 = new Rock();
addObject(myRock2, 2,Greenfoot.getRandomNumber(11));
Rock myRock3 = new Rock();
addObject(myRock3, 3,Greenfoot.getRandomNumber(11));
Rock myRock4 = new Rock();
addObject(myRock4, 4,Greenfoot.getRandomNumber(11));
Rock myRock5 = new Rock();
addObject(myRock5, 5,Greenfoot.getRandomNumber(11));
Rock myRock6 = new Rock();
addObject(myRock6, 6,Greenfoot.getRandomNumber(11));
Rock myRock7 = new Rock();
addObject(myRock7, 7,Greenfoot.getRandomNumber(11));
Rock myRock8 = new Rock();
addObject(myRock8, 8,Greenfoot.getRandomNumber(11));
Rock myRock9 = new Rock();
addObject(myRock9, 9,Greenfoot.getRandomNumber(11));
Rock myRock10 = new Rock();
addObject(myRock10, 10,Greenfoot.getRandomNumber(11));
}