How to I get a random number?

Discussion in 'Jiggy Runtime Development' started by oddin85, May 30, 2008.

  1. oddin85

    oddin85 New Member

    Joined:
    Jan 6, 2008
    Messages:
    3
    Likes Received:
    0
    I'm new to Java and I'm not sure how to get a random number. I know in c++ you just call rand(); everything I've tried, has just crashed, and I can't find any reference to either rand or random in the jiggy docs. any help would be appreciated. thanks

    Please Register or Log in to view images

  2. dudemanbra123

    dudemanbra123 New Member

    Joined:
    Feb 3, 2008
    Messages:
    81
    Likes Received:
    1
    Device:
    iPod touch
    You can find a lot of things in javascript that is exactly the same as jiggy. I found this by googling "random number in javascript".

    var randomnumber=Math.floor(Math.random()*11)'

    11 is the highest number the random number can be.
    So if you want it to generate a number between 1 and 100 put 101.
  3. oddin85

    oddin85 New Member

    Joined:
    Jan 6, 2008
    Messages:
    3
    Likes Received:
    0

Share This Page