Results 1 to 11 of 11
  1. #1
    suprabha is offline Member
    Join Date
    Jul 2008
    Posts
    20
    Rep Power
    0

    Unhappy [SOLVED] auto generated numbers

    hi all
    i need java code to auto generate numbers in seial order..pls find a code...

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,801
    Rep Power
    25

    Default

    seial order
    What does that mean? Can you give an example?

  3. #3
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    for (int i =0; i < Max; i++) {
    /// use i for something
    }

  4. #4
    suprabha is offline Member
    Join Date
    Jul 2008
    Posts
    20
    Rep Power
    0

    Default

    its generating number automatically whenever we log into one page...i have code to generate in random way..but i need in serial order

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Still not clear what you are looking. You can randomly generate a number, but what you mean serial order?

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,801
    Rep Power
    25

    Default

    new number = old number + 1

    This generates numbers in serial order.

  7. #7
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by suprabha View Post
    i have code to generate in random way..but i need in serial order
    You are not explaining your question well. It is impossible to have "random" numbers be in sequential order. Something has to change, you have conflicting requirements.

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Yes it is. May be he's looking to order them in acceding or descending order. But it's not possible with random numbers. But you can tricky there. Each random number store in an array list, and just after adding number to the list sort the list. But this is useless because waste lots of resources. Just think what happened if you need 1000 random numbers.

  9. #9
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Post psuedo random?

    Quote Originally Posted by fishtoprecords View Post
    .... It is impossible to have "random" numbers be in sequential order. .....
    Psuedo-random probably, your the master so suggest original poster read the docs for Random.next.... Likely will do what is needed. identical sequences of numbers
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  10. #10
    suprabha is offline Member
    Join Date
    Jul 2008
    Posts
    20
    Rep Power
    0

    Default

    thank you all for responding..i got the solution

  11. #11
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by suprabha View Post
    ..i got the solution
    You should post your solution so others with the same problem can learn as well

Similar Threads

  1. IDE with auto completion?
    By iceflyin in forum New To Java
    Replies: 8
    Last Post: 04-21-2008, 02:07 PM
  2. getting dynamically generated valus
    By abhiN in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 03-29-2008, 11:58 AM
  3. passing dynamically generated values
    By abhiN in forum Advanced Java
    Replies: 1
    Last Post: 01-20-2008, 04:21 AM
  4. Generated servlet error
    By tommy in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-05-2007, 11:46 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
  •