Need help saving random integer

Discussion in 'Plugin Development' started by baconlover51, Jul 6, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    baconlover51

    so im trying to make a lottery plugin but i cant seem to save the random integer so that everytime i call it it wont randomise again everytime i call check it gives me another random number when i just want it to give me the same number everytime intill i tell it otherwise can anyone tell me how to do this?


    int winningnumber = rn.nextInt(5) + 1;

    else if(cmd.getName().equalsIgnoreCase("check"))
    {
    holder[0]= winningnumber;
    player.sendMessage(ChatColor.GOLD + "The Winning Lotto Number is " +holder[0]);

    }
     
  2. Offline

    HeadGam3z

    Have you tried putting your winningnumber variable above your onCommand() method?...
     
  3. Offline

    Wizehh

    And for good measure, make the variable final - just so you can't accidentally reinitialize it.
     
  4. Offline

    baconlover51

    oh thx that worked!!!
     
Thread Status:
Not open for further replies.

Share This Page