Results 1 to 5 of 5
  1. #1
    tornbacchus is offline Member
    Join Date
    Apr 2009
    Posts
    17
    Rep Power
    0

    Default RTP question about random numbers

    im using rtp and creating a mastermind game, and i need the computer to give me a random number, but i cant just use math.Random..., i only want it to randomly pick these numbers:

    123, 132, 213, 231, 312, 321

    is there any way i could do this... whats the code etc that i need for this to be done.

    thanks.

  2. #2
    tornbacchus is offline Member
    Join Date
    Apr 2009
    Posts
    17
    Rep Power
    0

    Default

    and does anyone know the code to set the cursor at a certain point on the screen? i forgot the code

    c.setcursor (or something like that)

    thanks again

    ps im using HSA template, if that matters.

  3. #3
    CJSLMAN's Avatar
    CJSLMAN is offline Moderator
    Join Date
    Oct 2008
    Location
    Mexico
    Posts
    1,159
    Rep Power
    8

    Default

    Can you use the Random class?

    Random (Java Platform SE 6)

    Luck,
    CJSL
    Chris S.
    Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.

  4. #4
    tornbacchus is offline Member
    Join Date
    Apr 2009
    Posts
    17
    Rep Power
    0

    Default

    i was looking at it and its like a different language to me, but i could understand some stuff. im a beginner at this, but someone else told be about generating permutations for a given set of numbers

    w******ww.d*********evx.com/tips/Tip/20816 (i only have 5 posts) remove stars

    is there an easy way of doing this, im lost on this part

    thanks again

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You could put the numbers into an ArrayList<Integer>, say called "yourList", and then call Collections.shuffle(yourList). Then each time you need a number, check that the list isn't empty (size > 0), remove the 0th item and use it.

Similar Threads

  1. Replies: 8
    Last Post: 04-19-2009, 06:50 PM
  2. Help with random numbers
    By checkmylongboarding in forum New To Java
    Replies: 2
    Last Post: 01-12-2009, 06:47 AM
  3. Random numbers
    By jithan in forum Advanced Java
    Replies: 3
    Last Post: 06-14-2008, 03:04 PM
  4. random numbers without random class`
    By carlos123 in forum New To Java
    Replies: 4
    Last Post: 01-17-2008, 11:44 PM
  5. random numbers
    By carlos123 in forum New To Java
    Replies: 1
    Last Post: 12-22-2007, 03:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •