Results 1 to 4 of 4

Thread: Random numbers

  1. #1
    jithan is offline Member
    Join Date
    Jun 2008
    Posts
    39
    Rep Power
    0

    Default Random numbers

    hello friends,

    I want to create a random numbers like image verification no it means when we register any of the site it is asking image verification no ........ i have to create that type random no ...... i hope u will help me.......... it s very urgent......

    Thanks in advance......

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    freedom exists in the world of ideas

  3. #3
    jithan is offline Member
    Join Date
    Jun 2008
    Posts
    39
    Rep Power
    0

    Default

    Thank q Mr.sukatoa...i saw that but i want random alphanumeric values...... pls help me......

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

    Default

    i saw that but i want random alphanumeric values
    Ah, the dreaded "requirement creep". You will do better here to post your full requirements at the beginning of the thread rather than later. What you may do here is create a random number between say 33 and 126 and then cast the number to a char.

    for instance:
    Java Code:
        int delta = '~' - '!' + 1; // the difference between the top and bottom ascii character
        Random random = new Random();
        for (int i = 0; i < 500; i++)
        {
          char randomChar = (char)(random.nextInt(delta) + '!');      
          System.out.print(randomChar + " ");
          if ((i+1) % 20 == 0)
          {
            System.out.println();
          }
        }

Similar Threads

  1. random numbers without random class`
    By carlos123 in forum New To Java
    Replies: 4
    Last Post: 01-17-2008, 10:44 PM
  2. random numbers
    By carlos123 in forum New To Java
    Replies: 1
    Last Post: 12-22-2007, 02:56 AM
  3. Math.Random
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-23-2007, 02:09 PM
  4. random numbers without using java funtions
    By carlos123 in forum New To Java
    Replies: 8
    Last Post: 11-16-2007, 10:13 AM
  5. generating random numbers in a 5x5 array.
    By acidacid in forum New To Java
    Replies: 3
    Last Post: 08-14-2007, 03:44 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
  •