Random number in forms developer

Hi, dear all:
How can i produce random number in forms ?
regards.
kevin

Actually I tried several combinations but the (b-a )+a didnt work for me.
It always gives me 4000000000 is out of range. Without the 32768 also its that way.
int temp = (int)((((4000000000-1000000000)+1000000000) *(Math.random() * 32768));Heres the entire loop.......size is the size of the foo Array I want to fill
          for (int i = 0; i < size; i++)
int temp = (int)((((4000000000-1000000000)+1000000000) *(Math.random() * 32768)));
              //int temp = (int)Math.random()*32768;//Make random number same as c++
              if((temp < 1000000000)||(temp > 4000000000))
                   i--;
              else
                   foo[i] = temp;
                    System.out.println("Original Array: "+foo);

Similar Messages

  • Updating a field that generates random number when form is reset..

    I have a field that will generate a random number when the form is initially opened. THis fiekd runs an initialization script of : var randomnumber=Math.floor(math.random()*99999) and then a calculation script of randomnumber.
    The field value is set as Calculated - Read Only.
    When I hit the Reset button and it clears all the input fields for the form i would like to have it re calculate a new random number. I am not knowledgable in any scripting language and what I have so far I found by searching the forums.
    Any help would be appreciated.
    Thanks

    I don't know if it should matter, but the field to update is on a page other than the one with the reset button. And, the above is not working.
    I tried it as you stated above fieldname.rawvalue=randomnumber and I tried pagename.fieldname.rawvalue=randomnumber

  • Need Urgent Help! Forms Developer CD Part number???

    question 1:
    I want to know then Software Product CD Part number, Part # ?????
    for purchase.
    Product name:
    Oracle Forms Developer/Services 6i Release 2 for Sun SPARC Solaris
    Release 2 , not Release 1!!
    thank you !
    question 2:
    higher patchset includes lower patchset ???
    for example: Forms Developer Patch 5a includes Patch 4a ???
    if no, what's relationship between Patch 5a and Patch 4a ???
    Thanks!!!

    But the thing that makes me wonder is, my BIOS version is the latest but why this type of problem occurs??
    What version of BIOS should I use?? Any recommendation ??
    Thanks.

  • Auto number each form when distributing by email

    I need to assign a number to each form during or before emailing, anyway to do that with scripting? Thanks for all the help, I am getting so close to having everything I need for this form.
    Thanks
    Mike

    Hi Mike,
    I have used the following technique to auto-number a form:
    1) Create a hidden field and use a FormCalc function to get the date-time when the form is opened
    // form1.purchaseOrder.header.DateTimeField1::initialize - (FormCalc, client)
    // The hidden field DateTimeField1 is used as the source for the P.O. number.
    // The function, below, returns a string in the format 20081107055344 where 20081107 is YYYYMMDD and 055344 is HHMMSS.
    $.rawValue = Concat(Num2Date(Date(), "YYYYMMDD"), Num2Time(Time(), "HHMMSS"));
    2) On the target id field extract the month, day, and time (down to the millisecond)
    // form1.purchaseOrder.header.poNum::calculate - (JavaScript, client)
    // DateTimeField1 is used to generate a unique P.O. number (see the initialize event on DateTimeField1).
    // DateTimeField1 produces a value in the format 20081107055344, for example. In this example the substring
    // removes the year 2008 to produce the P.O. number 1107055344.
    var str = form1.purchaseOrder.header.DateTimeField1.rawValue;
    this.rawValue = str.substring(4,18);
    There are many techniques including the creation of a random number using the JavaScript math.random() method.
    See https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Math/random
    Steve

  • Creation of random number through system fields

    Hi ,
    I like to create a random number generation program.(apart form system time) .
    I have noticed  that system response time differs (minimal variation in terms of milliseconds) every time
    when we execute a program .
    In that case could i know how to get the  system response time and interpretation time from system fields in program !
    Note : I like to know the table in which these values can be retrieved (like TRDIR for other system fields)

    use these function modules.
    QF05_RANDOM
    RANDOM_AMOUNT.

  • How to define "leading" random number in Infoset fpr parallel processing

    Hello,
    in Bankanalyzer we use an Infoset which consists of a selection across 4 ODS tables to gather data.
    No matter which PACKNO fields we check or uncheck in the infoset definition screen (TA RSISET), the parallel frameworks always selects the same PACKNO field from one ODS table.
    Unfortunately, the table that is selected by the framework is not suitable, because our
    "leading" ODS table which holds most of our selection criteria is another one.
    How to "convince" the parallel framework to select our leading table for the specification
    of the PACKNO in addition (this would be times 20 faster due to better select options).
    We even tried to assign "alternate characteristics" to the packnos we do not liek to use,
    but it seems that note 999101 just fixes this for non-system-fields.
    But for the random number a diffrent form routine is used in /BA1/LF3_OBJ_INDEX_READF01
    fill_range_random instead of fill_range.
    Has anyone managed to assign the PACKNO of his choice to the infoset selection?
    How?
    Thanks in advance
    Volker

    Well, it is a bit more complicated
    ODS one, that the parallel framework selects for being the one to deliver the PACKNO
    is about equal in size (~120GB each) to ODS two which has two significant field which cuts down the
    amount of data to be retreived.
    Currently we execute the generated SQL in the best possible manner (by faking some stats )
    The problem is, that I'd like to have a Statement that has the PACKNO in the very same table.
    PACKNO is a generated random number esp. to be used for parallel processing.
    The job starts about 100 slaves
    Each slave gets a packet to be processed from the framework, which is internaly represented
    by a BETWEEN clause on this PACKNO. This is joined against ODS2 and then the selective fields
    can be compared resultin in 90% of the already fetched rowes can be discarded.
    Basicly it goes like
    select ...
    from
      ods1 T_00,
      ods2 T_01,
      ods3 T_02,
      ods4 T_03
    where
    ... some key equivalence join-conditions ...
    AND  T_00.PACKNO BETWEEN '000000' and '000050' -- very selective on T_00
    AND  T_01.TYPE = '202'  -- selective Value 10% on second table
    I'd trying to change this to
    AND  T_01.PACKNO BETWEEN '000000' and '000050'
    AND  T_01.TYPE = '202'  -- selective Value 10%
    so I can use a combined Index on T_01 (TYPE;PACKNO)
    This would be times 10 more selective on the driving table and due to the fact,
    that T_00 would be joined for just the rows I need, about a calculated time 20-30 faster.
    It really boosts when I do this in sqlplus
    Hope this clearyfies a bit.
    Problem is, that I can not change the code either for doing the
    build of the packets or the one that executes the application.
    I need to change the Inofset, so that the framework decides to build
    proper SQL with T_01.PACKNO instead of T_00.PACKNO.
    Thanks a lot
    Volker

  • How can I create a random number and letter in a text field...

    Hi All,
    I am using application express. I want to get a random number and letter for a text field but not sure how to do this. Say I have a licence form and I want to get the licence number automatically when user wants to create a new licence and it needs to be unique. The format I am looking for is - HQ2631 something like this.
    I am thinking I have to create a trigger but not sure how to go about this....
    advanced thanks,
    Tajuddin

    Something to play with:
    Your method can generate 26 * 26 * 10000 different licence_ids
    Generating one million ids takes 20 seconds but produces between 70000 and 80000 duplicates and is rapidly getting worse (if that is something over 7%, doubling the ids generated that grows to something under 30%)
    Just see if you can live with that.
    select sum(collisions) all_duplicates,count(*) distinct_duplicates,max(collisions) max_multiple
      from (select licence_id,count(*) - 1 collisions
              from (select DBMS_RANDOM.STRING('',2) || trunc(DBMS_RANDOM.VALUE(1000,9999)) licence_id
                      from dual
                     connect by level <= :to_generate
             group by licence_id
             having count(*) > 1
           )Regards
    Etbin

  • FPGA Poission Random Number

    Hello,
    I have Xilinix Virtex 5 FPGA and i want to implement poisson random number generator.
    FPGA works at 100 MHz clock and at every cycle it should calculate poisson random number. Mean value of poisson distribution can change at every clock cycle. I want to make random time pulse generator with possion distribution. Pulse rate can vary between 1 and 1 billion pulses per second.
    How i can make this generator? Please, help

    b,
    There are two kinds of randomn number generators that are commonly implemented in a FPGA device:  a true random number generator (very hard to do), and a pseudo random number generator (trival to do).
    The pseudo  random generator is done using linear feedback shift registers, and its statistics are well understood, and do not vary (in fact, the sequence repeats depending on the length of the LFSR).
    Attached is a form of true random number generator.
    To get a specific distribution (e.g. Poisson) you would need to verify and [perhaps filter the genberated numbers.
    Poisson being as close to radomn as possible (for example, radioactive decay times are Poisson distributed), a true randomn number generator is where I would start (the attachment).
     

  • How to generate a unique random number in a MySQL db

    I'm creating a volunteer and also a separate vendor application form for an airshow. The volunteer and vendor info is stored in separate tables in a MySQL db, one row per volunteer or vendor. There will be about 100 volunteers and 50 vendors. When the application is submitted it should immediately be printed by the applicant, then signed and mailed in. This past year we had problems with some people who didn't immediately print their application so I'd like to still give them the option to immediately print but also send them an e-mail with a link to their specific row in the MySQL db. I have an autoincrement field as the primary key for each table, but I think sending this key to the applicant in an e-mail would be too easy for them to guess another id and access other people's info.
    I'm thinking I should add a column to each table which would contain a unique random number and I would then send this key in the e-mail to the applicant. So, can anyone suggest a simple way to do this or suggest a better way of giving the applicant a way to access their own application and no-one elses after they have submitted their form?
    Thanks all.
    Tony Babb

    Thanks so much, that was very helpful. I added the code you suggested to create and display the random number - I called it "vollink" and that worked fine. Then I added the hidden field toward the bottom of the form - it shows at line 311 when I do a "View Source in Int Explorer and then tried adding the code to add it to the table and when I tested it failed with "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1" . The test version of the page is here www.hollisterairshow.com/volunteerapp2.php . The changes I made to add it to the table is shown below , I must be missing something blindingly obvious, if you could suggest a fix I'd really appreciate it. I did add the field to the MySQL table also.
    Thanks again
    Tony
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO volunteers (firstname, lastname, email, thursday, friday, saturday, sunday, monday, activity, talents, specialrequests, tshirt, phone, street, city, st, zip, updatedby, vollink) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, $s)",
                           GetSQLValueString($_POST['firstname'], "text"),
                           GetSQLValueString($_POST['lastname'], "text"),
                           GetSQLValueString($_POST['email'], "text"),
                           GetSQLValueString($_POST['thursday'], "text"),
                           GetSQLValueString($_POST['friday'], "text"),
                           GetSQLValueString($_POST['saturday'], "text"),
                           GetSQLValueString($_POST['sunday'], "text"),
                           GetSQLValueString($_POST['monday'], "text"),
                           GetSQLValueString($_POST['activity'], "text"),
                           GetSQLValueString($_POST['specialtalents'], "text"),
                           GetSQLValueString($_POST['specialrequests'], "text"),
                           GetSQLValueString($_POST['tshirt'], "text"),
                           GetSQLValueString($_POST['phone'], "text"),
                           GetSQLValueString($_POST['street'], "text"),
                           GetSQLValueString($_POST['city'], "text"),
                           GetSQLValueString($_POST['st'], "text"),
                           GetSQLValueString($_POST['zip'], "text"),
            GetSQLValueString($_POST['vollink'], "text"),
                           GetSQLValueString($_POST['lastname'], "text"));
      mysql_select_db($database_adminconnection, $adminconnection);
      $Result1 = mysql_query($insertSQL, $adminconnection) or die(mysql_error());

  • Problems with SCM server 10g and Forms Developer 6i&9i

    Hi,
    I installed SCM server 10g and try to use it with Forms developer 6i and 9i. The connection to the server works ok but when I choose the container from Source Control Options to check in forms they always go one level higher in the container hierarchy. With Forms developer 10g it is working fine. What might cause this?
    Thanks,
    Tomi

    You are missing one key piece of information from your email - the error message that you got.
    can you specify what was the error number?
    Once you have this number I'll suggest that you look it up on the online documentation of the database available on otn (just do a search on OTN with the error number).

  • Generate a random number and make it STAY after "save"

    I searched around this forum and found that I can use this code to generate a random number:
    //this.rawValue = Math.round(Math.random() * 1000000);
    Works great. only problem is, once I practice on the "real" form and save, close, and reopen - it changes the random number every time. I need to figure out a way to make it save the 1st number it generates when someone opens the form and types info in it....then they save and close, etc.
    Can anyone help me? Thanks!!

    Example steps:
    1. Add a hidden field to the same subform with name 'hiddenField'.
    2. First time you open 'hiddenField' rawValue will be null.
    3. where ever you run the code to generate random number use scenario like this.
    if (hiddenField.isNull) {
    this.rawValue = Math.round(Math.random() * 1000000);
    }else {
    this.rawValue = hiddenField.rawValue;
    Hope this thelps.
    SekharN

  • Oracle Forms Developer/Services 6i Release 2 for Sun SPARC Solaris

    Exist? :
    Oracle Forms Developer/Services 6i Release 2 for Sun SPARC Solaris
    6i Release 2 ,it's product or patch ?
    I want to know then Software Product CD Part number, Part # ????? Release 2 , not Release 1!!

    I'm getting the page not found error on trying to download the setup Oracle Forms Developer 6i Release 2 for 95/98/NT/2000/XP from:
    http://www.oracle.com/technology/software/products/forms/htdocs/winsoft.html

  • Random number generation that sticks

    Hello,
    I would appreciate any help with the appropriate JavaScript to generate a random 8 digit number XXXX-XXXX on a form when the user starts to enter data. This number would need to be permanent so that it can be used as a tracking identifier later.
    Thanks for looking.
    Dawson

    If you're using Oracle8i, you can use the new SAMPLE clause in the FROM clause of the SELECT statement to query a random sample from a single table. Otherwise, just write a simple random number generator in PL/SQL (see any good algorithm book under the topic "Psuedorandom number generator"). You need to understand a bit about statistics, if being "truly" random is important, to use these tools.

  • Random number Primary Key column

    Hi All
    I am trying to set up a method of stopping....better I explain
    A multipart form is filled out (anyone can access this form)
    using ADDT the only way I can get the info from pageto page is form1?id=id
    If person 1 fills out the form the default primary id = 1
    If person 2 fills out the form the default primary id = 2
    However if person 2 thinks, lets see what person 1's details are, he/she/it only has to change the ID to 1
    I thought to get around this a random number would be great.
    Does anyone know how I would set the primary key to a random number using ADDT
    I will try and work this out in the meantime.
    Cheers
    Laurence

    Hi Laurence,
    My first thought would be to go over this tutorial.
    Straight to tutorial:
    http://www.interaktonline.com/Documentation/MXKollection/076200_tutorialuserauthentication .htm
    All of the online documentation: (Keep in mind this was when ADDT was MXKollection) So if you encounter differences use your best judgment.
    http://www.interaktonline.com/Documentation/MXKollection/
    My thinking is...
    1. User goes to register, they fill out form 1 (email, name, etc).
    2. Values from form 1 get carried to form 2 (hidden values, session or post) then they fill out form 2. (Address, phone, etc).
    3. Completion of form 2 has 1 insert trigger to enter in all data from both forms.
    Basically at this point the user has entered all profile information and is waiting on confirmation email to accept membership.
    Then in the membership side they can edit their profile based on an total authentication system. Because if you don't have one in place users will always be able to manipulate your $_GET values to see other peoples data.

  • Greek (alfa) character in forms developer 10g

    Hi everyone,
    I'm trying to assign the first letter of the Greek alphabet to a text_item, but I don't know how to get it. I get no problem when trying to show ß using chr(223) or µ using chr(181) but no idea how to write the alfa char.
    By the way, registry/server/client settings cannot be modified in the environment, so the solution should be done inside forms developer, as in this case is a "developer problem" ( mine's :( ).
    Any idea?
    Thanx in advance.
    Regards

    Hi,
    May be this link will help
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/sql_elements002.htm#g195937
    declare
    i number := 1;
    res varchar(10);
    begin
    loop
    select chr(i) into res from dual;
    dbms_output.put_line(i||' , '||res);
    i := i+1;
    exit when i=255;
    end loop;
    end;

Maybe you are looking for