GENERATION OF NUMBERS

Pls, I have written a program. However, I'm expected to include sub-program that will generate numbers automically for students. For example, the number for first student may be 12367GE and the next may 56789AW.
Pls, how do I do that?
Thanks

Thare is no problem in generating random number you can use Random class for that.
But the problem is making sure that your applet generate unique numbers.
No Random Number generation algorithm garantees the generation of unique number they just geive "Random Numbers" and there can be duplicates.
So your program will need a way to store the previously generatly numbers so when you generate the next one you have to compare the generated number with the old ones to make sure it is unique if not uniques you have to repeat the proces until you get a unique number.
Using a file is not good idear since once the file grow in to a large one the algorithm will run very slow.
Keeping them in memory is not that good becouse you will loose them when the server is restarted and also can caoue out of memory errors.
A simple database will be the best option to keep the old data
Ex:-
   while(true){
     int newNumber = generateRandomNumber();
     if (oldNumbers.isUnique(newNumber)){
        oldNumbers.store(newNumber);
        return newNumber;
   }Or you will have to write a random munber algorithm which always garantees to generate unique numbers without actually storing and compairing with the old numbers

Similar Messages

  • Five Random Number Generation between numbers 10-20

    I want to generate 5 random numbers (U32) between a range of 120 and 180 with equal distribution. Can i do it? I tried using white noise generation VI, but it gives numbers from [-a,a].
    Thanks in advance.

    stevem181 wrote:
    Note that the 120 and 180 values occur about half as often as the other values.
    To correct that flaw, multiply by 61 and round to -infinity. For example like this:
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    RandomRange.png ‏17 KB

  • Random number generation in numbers

    I cannot find out how to create a random number colum. It ios very easy on Excell ,but my attempts on numbers have been frustrating. I look at the instructions, but when I click on formulas it doesnt show the whole list.

    Clark,
    You might find it convenient to have Formulas and Functions Help open as you work on your document. It has a little different layout than the Function Browser.
    Jerry

  • Random generation of numbers

    Hi,
    I need to generate numbers randomly between the range of 1-50. I was trying to use the DBMS_RANDOM package. But, this seems to work best for numbers at least 6 digits long. I don't want any duplicate numbers also. Any ideas?
    Thanks so much.

    Hi,
    I need to generate numbers randomly between the range of 1-50. I was trying to use the DBMS_RANDOM package. But, this seems to work best for numbers at least 6 digits long. I don't want any duplicate numbers also. Any ideas?
    Thanks so much. maybe this way
    write a PL/SQL funtion returning resul-set with many - say twice as much as you need - random number
    via ref-curcsor
    ( make count returned rows a parameter and mod()-value for the function )
    select distinct * from the_ref_cursor

  • Numbers missing from second half of printed document

    Here is a mystery for you. I have converted my rather large help project to a very large Word document and then PDF. The interesting behavior I am seeing is that about halfway through the document the numbers and bullets have disappeared. We have put the numbers and bullets in the same throughout the project but in the second half of the document they are missing. They are in place in the first half of the document.
    The project has been around since RoboHelp X.5 and is now in RoboHelp 8. The projects are intermixed with what release they were created in. The document is 2334 pages long and I lose numbering and bullets after page 1133.
    Any ideas would be greatly appreciated.
    Thanks,
    Nita

    Thank you Leon and Peter for your timely answers. The numbering and bullets do work when I break the document into smaller documents (it took three). The difficulty I am now facing is that if I try to combine those documents after generation, the numbers stop working again. The document has a TOC on the front so I wanted to combine them within Word to get the TOC accurate by updating - curses.
    The only solution I've come up with so far, which is kind of awkward is:
    Have RoboHelp generate the entire document in order to get the TOC
    Generate the next two documents wiht just the smaller sections.
    Delete the extra two sections from the first document.
    PDF all three and combine.
    This will break links that are between sections of the document and runs the risk of not the TOC not being accurate.
    Can you think of a better way?
    Thanks,
    Nita

  • Dbtab Getting Cleared

    Hi All
      I am using one Y table for generation of numbers. This table stores the last no generated for a particular combination. But anyhow this table is getting reset and am unable to find the cause.
    When i wnt through the coding, i found it ok. First the max value is being selected from the table and after all the opearation is been done, the dbtab is being modified from an itab of the same structure.
    There is also a check if no number is found. In that case it'll throw an error message.
    Still then am unable to find the cause.
    I am using Modify statement along with commit work if modification is a success else rollback work.
    Need suggestions urgently.
    With Regards
    Pradipta K. Mishra

    But if am not wrong then Insert will created more than one line item in the table which is not my requirement. My table is to contain only the last generated number.
    Code is like :
    Fetching the max no.
    Select max ( no )
    from dbtab
    into w_var
    where <condn> .
    if sy-subrc <> 0.
        message e024.
    endif.
    Then after doing the necessary operation,
    wa_itab-no = w_var1.
    append wa_itab to itab.
    Modify dbtab from table itab.
    if sy-subrc = 0 .
    commit work.
    else.
    rollback work.
    endif.

  • Finding next number

    hi gurus,
        what is the Fm for auto generation of numbers & how to get the number range object for date.
    thaks & regards,
    santosh.

    Hi,
    Use FM NUMBER_GET_NEXT
    see the sample code:
    *& Form GET_NEXT_NUMBER
    FORM get_next_number_class.
    DATA: inumber(10) TYPE c.
    SELECT SINGLE * FROM klah WHERE class = 'PRODUCTCODE'.
    IF sy-subrc NE 0.
    entry in KLAH is not yet exiting => get next number
    CALL FUNCTION 'NUMBER_GET_NEXT'
    EXPORTING
    nr_range_nr = '01'
    object = 'KLASSE'
    quantity = '1'
    SUBOBJECT = ' '
    TOYEAR = '0000'
    IGNORE_BUFFER = ' '
    IMPORTING
    number = inumber
    QUANTITY =
    RETURNCODE =
    EXCEPTIONS
    INTERVAL_NOT_FOUND = 1
    NUMBER_RANGE_NOT_INTERN = 2
    OBJECT_NOT_FOUND = 3
    QUANTITY_IS_0 = 4
    QUANTITY_IS_NOT_1 = 5
    INTERVAL_OVERFLOW = 6
    BUFFER_OVERFLOW = 7
    OTHERS = 8
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ELSE.
    entry is already existing => take the number
    inumber = klah-clint.
    ENDIF.
    ENDFORM. " GET_NEXT_NUMBER
    Regards,
    Satish

  • Dumb question regarding CPU architecture

    The question I'm about to ask must seem like really basic knowledge to most of you, so first of all, I apologize to subjecting you all to such a dumb question. Anyway -
    I am looking to try ArchLinux out. I'm quite experienced with the two major commercial platforms, have used several other "no setup" Linux distros, and am comfortable with the command line for the most part. Arch, I thought, would be interesting to try out - something a little more to sink my teeth into.
    So I hopped on over to the download page, where I am asked to choose the file appropriate for my processor's architecture. Thing is, as a longtime Mac user who has only recently become acquainted with Intel and AMD CPUs, I don't know some details. I know basics and the major differences between them, but not the architecture.
    Without further ado, the question: Are desktop Core i5s i686 processors? Is the i686 build required or more suited for the processor than the generic x86-64 build?
    Thanks!

    iindigo wrote:
    The question I'm about to ask must seem like really basic knowledge to most of you, so first of all, I apologize to subjecting you all to such a dumb question. Anyway -
    I am looking to try ArchLinux out. I'm quite experienced with the two major commercial platforms, have used several other "no setup" Linux distros, and am comfortable with the command line for the most part. Arch, I thought, would be interesting to try out - something a little more to sink my teeth into.
    So I hopped on over to the download page, where I am asked to choose the file appropriate for my processor's architecture. Thing is, as a longtime Mac user who has only recently become acquainted with Intel and AMD CPUs, I don't know some details. I know basics and the major differences between them, but not the architecture.
    Without further ado, the question: Are desktop Core i5s i686 processors? Is the i686 build required or more suited for the processor than the generic x86-64 build?
    Thanks!
    i686 was (strictly speaking) the Pentium Pro processors
    i786 was Netburst, i.e. Pentium4/D
    i886 was Core2
    i986 is Nehalem/Westmere (i.e. your i7/i5/i3)
    That being said, the ix86 terminology was dropped due to copyright as I recall.  LOTS of stuff on Wiki on this topic--throw those CPU generation ix86 numbers in and read away.  You're using a Core2 or higher, there's no reason not to us 64bit.
    Last edited by Skripka (2010-08-01 12:29:37)

  • I upgraded my 3rd generation ipad to ios 6.0.1 and now am experiencing various issues.  Neither Pages or Numbers will open.  I just see a gray screen that says Pages or Numbers at the top and all of my documents are gone.

    I upgraded my "new ipad" (the 3rd generation I think) to ios 6.0.1 and now am experiencing various issues. 
    1- Neither Pages or Numbers will open.  I just see a gray screen that says Pages or Numbers at the top and all of my documents are gone. The icon that allows me to create a new document also does not appear.  I went to icloud.com to see whether my documents still existed, which brings me to the 2nd problem.
    2- It appears that all of my Pages documents are still on icloud, but all of my Numbers documents are gone.  There were only about 10, but I access 2 of them nearly every day, so this is a big issue for me.
    I went into Settings and all of the icloud information is correct and it "Documents & Data" is on.  When I look at the storage, I see the Pages documents but not the Numbers ones.  The next thing I did was turn my ipad off and back on, but this didn't fix anything.  Since my Pages documents are still on icloud, I then tried to delete the Pages app from the ipad so that I could reinstall it, which resulted in the 3rd problem.
    3- I cannot delete any apps.  I can get all of the icons to shake and the small x IS available, but everything freezes when I click it.  I can't do anything at that point except reset the ipad or wait until it eventually restarts itself.  I've tried this with Pages as well as multiple other apps, all with the same result.  I've also tried downloading a new app (which worked fine) and then deleting that one, but I got the same result.
    3a- A small related issue to this that I am far less concerned about is that when the ipad restarts itself, it comes back on and the screen is really dark and I can barely make out what appears on the screen.  If I enter my password right away, it stays that way until I go into Settings - Brightness & Wallpaper and touch the brightness setting (although I'm not actually changing the setting because it already shows that the brightness is turned up a little over halfway).  If I don't enter my password right away and let it go completely dark, then click the home button, the brightness is fine.
    So now I'm stuck.  My guess is that I will need to restore it, but wanted to check before I take that step.  Unfortunately, my laptop is on its deathbed so I haven't been synching my ipad to it and I fear my Numbers documents are gone forever.  I'd like to try everything I can to fix these issues before doing the restore in hopes that I can get the Numbers documents back.
    Any suggestions for any or all of these problems?

    Purplehiddledog wrote:
    I do backup with iCloud.  I can't wait until the new iMac is available so that I can once again have my files in more than 1 location without needing to rely solely on the cloud. 
    I also rely on iTunes and my MacBook and Time Machine as well as backing up to iCloud. I know many users know have gone totally PC free, but I chose to use iCloud merely as my third backup.
    I assume that the restore would result in my ability to open Pages and Numbers and fix the problem with deleting apps, but this would also mean that if my Numbers documents still exist solely within the app and are just not on iCloud for some reason that they would be gone forever.  Is that right?
    In a word, yes. In a little more detail.... When you restore from an iCloud backup, you must erase the device and start all over again. There is no other way to access the backup in iCloud without erasing the device. Consequently, you are starting all over again. Therefore, it would also be my assumption that Pages and Numbers will work again and that the deleting apps issues would be fixed as well.
    If the documents are not in the backup, and you do not have a backup elsewhere, the documents could be gone forever.

  • Report Generation Toolkit: Page Numbering

    When creating a Word Report using the Report Generation Toolkit, I am using the Word Set Page Numbering.vi to display the page numbers in the footer of each page of the report. This works fine when the include page x of n switch is turned OFF. However, when the switch is turned ON the numbers only show up in the left footer regardless of the position setting.
    Is this a known bug?
    If not where do I report it?
    I guess I just did...

    Hi Drugar,
    I have filed a CAR (43K9NBF2) regarding this issue.  I will look into fixing it for the next version of the Report Generation Toolkit.  If you want to workaround the problem for now, go into vi.lib\addons\_office\word.llb\Word_auto_text_entry (for page number).vi.  You can get a reference to the "Selection" property of the Application class.  Then under Selection, get a reference to "ParagraphFormat".  Then, you can set the "Alignment" property of the ParagraphFormat class.
    Thanks for reporting this issue, and let me know if you have any other questions.
    -D
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • How do I use page numbering and a text block in a footer in Word with the Report Generation Toolkit?

    I am creating a Word document with the Report Generation Toolkit, and LabVIEW 8.2.1. In the report I am using a template that has page numbering enabled in the center. When I try to add a text block to the left side footer, it eliminates the page numbering and adds my text on the left side. I found "Set Report Footer Text" and "Word Set Page Numbering" vi's that may be the clue to this. When I use these two vi's I either get Page 1 of 456789-001 on the left side, or if I reverse the order I get only 456789-001(text) in the left side with nothing in the center. What I would like to achieve is 456789-001(text) on the left footer, and Page 1 of 2 in the center. Is this possible and if it is, then how can I do it?

    Hi SciManStev,
    I have attached a vi where you can see how they can be made to work together. You have to design it such that one follows the other. If you don't design it that way, it results in a race condition and only one of them get executed.
    Good Luck!
    Warm regards,
    Karunya R
    National Instruments
    Applications Engineer
    Attachments:
    SciMan1.vi ‏14 KB

  • Contract Generation question: Formatting, Numbering of clauses, variables

    Hi!
    I am trying to create a Contract Document Template (for Contract Generation) with Variables
    I created some Variable Collections, but when I link them to the Contract Template, they add on with a different formatting altogether, which is neither like the placeholder in the template nor like the template attached to the variable.
    My variable configuration was of the type Paragraph.
    If anyone has any helpful tips on formatting Contract Document Templates, it would be most appreciated.
    Also, how do I ensure that numbering of sections and clauses is sequentially made in the final Contract.
    Regards,
    Reshma

    I was able to fix the problem by making some word document format changes.
    Please ignore this question.
    Regards,
    Reshma

  • Serial numbers to generation at Sales Order Issue

    Hi someone knows about Serial Control
    Do use serial number at pick release is mandatory apply Installed Base?
    what´s different between serial numbers generation in reception and at Sales Orders Issue?
    thanks,

    Do use serial number at pick release is mandatory apply Installed Base?
    No it is not mandarory if you use this serial control (At Sales Order Issue). If you use serial number control at receipt then serial number is mandatory at the time of pick confirming.
    what´s different between serial numbers generation in reception and at Sales Orders Issue?
    At Receipt:
    You maintain serial numbers in inventory and transaction them in inventory for all transactions.
    At SO Issue:
    You enter the serial numbers only at the time of shipments.
    As IB knows the inventory controls it maintains the information accordignly. When in inventory serial numbers can be grouped into one instance as they do not have any serial number. Once shipped, the same instance will be split and is created as a different instance with the serial number.
    Thanks
    Nagamohan

  • Where can I find the model numbers for the various generations of TC?

    I'm trying to find out if there is some place within Apple to find the model numbers associated with the different generations of the Time Capsuls

    Don't think Apple provides this type of info, but MacTracker will have all the info that you want.
    Mactracker - Get Info on any Mac
    If you trust Wikipedia.....
    http://en.wikipedia.org/wiki/Time_Capsule_(Apple)
    Then click the "Did you mean Time Capsule Apple" link at the top of the page.

  • Do 1st generation Ipad have cell numbers?

    Do 1st generation Ipad have cell numbers? If so, how do i find? also, what is a good app for text with 1st generation ipad? thank you

    No.
    No Nano has any means of tracking it.

Maybe you are looking for

  • How to find a carriage return and Line feed?

    I need to detect if a crriage retunr and line feed present on each row in my text file before allowing user to upload the text file I know how to remove them from each line but what I need is to detect them no removing them from file. Our concern is

  • Site update strategies query.

    I've got my iWeb site up and running now, and I'm very happy with it. I've incorporated Haloscan comments via iComment as well as StatCounter. The problem is that the "post-processing" that I do is lost each time I decide to add a blog entry or other

  • Desktop Software version 5 phase out

    As last week i still can download the Blackberry Desktop Software version 5 at  'download' page of blackberry http://us.blackberry.com/apps-software/desktop/. But now i needed to go to 'service provider page' http://us.blackberry.com/support/downl

  • How do get ringtones from my music??

    I ahve so many songs but I cant use any of them for a ringtone. When I look up ringtone on the itune store I cant find the one I want. Is there a way to use your music as a ringtone??

  • Server Tomcat v5.5 Server @ localhost failed to start

    Hi guys, I've installed Eclipse 3.1, Tomcat 5.5 and Java 1.5.0 on Linux Red Hat 9. My application works fine when I run Tomcat in standalone. Instead when I run in embedded mode I receive the message in object and I can't find any log. Any help will