Random Number list

Lo peeps, I have a small problem, i'm trying to create a random number generator and create a list of size current_size. The code also generates the random number from zero to current_size. The following code seems to work correctly in generating a random number, but it doesn't create a list of random numbers, instead it creates a list of the same random number!!! Does anyone have any ideas?
import java.util.*;       // needed for Random
public class ListByArray
    private     int           current_size;
    private     String[]      data;
    private final int        default_max_size = 4096;
    public int createRandomList(String string_size)
        int i;
        int j;
        if(!isIntString(string_size)) {
            return 0;
        else {
            Integer size = Integer.valueOf(string_size);
            current_size = size.intValue();
        for(i=0; i<current_size; i++) {
            Random R = new Random();
            j = (int)(R.nextFloat()*current_size);
            data[i] = Integer.toString(j);
        return current_size;
    } //end createRandomList
} //end classIt's manly the for loop which I'm wondering about because I know the rest of the code works!!!.

That line creates a new pseudo random number generator with the current time (in milliseconds) as a seed. When you call r.nextFloat you don't actually get a random number but a number that is a function of the last number generated, or, if there are no numbers yet generated, of the seed (that's why they call them pseudo random number generators). So the sequence you get is totally dependent on the seed. Your loop seems to be passed so fast that the time in milliseconds doesn't change during it, with the result that you have many generators with the exact same seed and will produce the exact same sequence of numbers... and you use only the first number of each sequence.
But if you move the line outside the loop you'll have only one RNG that is seeded only once.
More info on RNGs: http://directory.google.com/Top/Computers/Algorithms/Pseudorandom_Numbers/

Similar Messages

  • 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

  • Applescript: how to record and return how many times a number appears when using a random number generator

    I create one rng and repeat another rng that many times like so:
    set x to (random number from 0 to 250)
    repeat x times
      set rn to (random number from 1 to 10)
    end repeat
    now what i would like to do is record and return how many times 'rn' comes up with one particular number. Any ideas?

    You could set up a list and increment the contents of a particular index each time it comes up, for example:
    set how_many to {0, 0, 0, 0, 0, 0, 0, 0, 0, 0} -- 1 thru 10
    set x to (random number from 0 to 250)
    repeat x times
      set rn to (random number from 1 to 10)
      set item rn of how_many to (item rn of how_many) + 1
    end repeat
    return how_many

  • 17 digit random number

    I need to create a 17 digit random number to be used as a primary field in a database. They must all be unique. First, what is the best way to create a 17 digit random number, and second, how do I make sure it is unique?

    I have a servlet that is parsing an email distribution
    list and creating multiple users. For each user I
    need to create a user id in the form of
    "ID87890988909099900" that is unique. I do not know
    how I would get Access to do this for me.Wow, you must have a lot of users. There aren't that many ants on earth.
    Seriously, if the ID will always start with ID, then can't you just leave it off the key and add it when the ID is displayed?

  • Lingo code to show a random number

    I am learning Director and my partner and I are trying write
    lingo code for when a button is clicked, a random number between 1
    and 6 is shown in a text field. Can someone help me? I tried the
    code in the Director help that is written: diceroll = (random (6) +
    random (6)). We want it for only one die, so we didn't add the
    second random(6), but we haven't been able to figure out what else
    we should be putting in the code. Thank you.

    quote:
    Originally posted by:
    graphics cat
    I have rechecked the spelling and it's still not working.
    Most of the time there is no error message, it just doesn't do
    anything. Sometimes this error comes up - Script error:
    SyntaxEffor: missing; before statment on nouseUp me.
    Please, could you post your code or even upload your file
    somewhere we can download and check it out. This will help greatly
    in trying to find the syntax error you are making.
    In the meantime, here's a few links you can check out that
    will facilitate learning Director:
    http://www.furrypants.com/loope/index.htm
    -- advanced lingo
    http://www.fbe.unsw.edu.au/learning/director/
    -- excellent tutorials
    http://www.dreamlight.com/insights/07/
    -- learning Lingo
    http://www.andyw.com/director/
    -- technical guide, tips n’ tricks
    http://www.director-onine.com
    -- articles and forum
    http://www.mediamacros.com/
    -- for scripts and more
    http://www.xtrasy.com/ --
    for xtras and links
    http://www.updateStage.com/
    -- for quirk list, articles and xtras
    http://www.lingoworkshop.com/
    -- for some pretty advanced code
    http://groups.google.ca/groups?hl=en&lr=&group=macromedia.director.lingo
    http://groups.google.ca/groups?hl=en&lr=&group=macromedia.director.basics
    http://www.zeusprod.com/
    -- some dated technical info
    http://www.proscenia.net/resources/tutorials/director/d1/index.html
    http://www.shocknet.org.uk/
    -- internet, XML, ASP/SQL, database connectivity
    http://www.jmckell.com/ -- Math
    Lingo
    http://www.vtc.com/products/directormx2004.htm
    -- free QT How To Videos
    http://www.shockwave3d.com/
    -- shockwave games
    http://www.shocksites.com/
    -- information/news repository
    http://www.noisecrime.com/
    -- cool 3D examples
    http://www.chromelib.com/
    -- shockwave 3D behavior library
    http://www.shocksites.com/
    -- good list of Director sites
    http://poppy.macromedia.com/~thiggins/
    -- Thomas Higgins
    http://multimediahelp.org/home/director.html?action=downloads
    http://nonlinear.openspark.com/alpha/
    -- James Newton’s site. Examples
    http://nonlinear.openspark.com/
    http://www.j-roen.net/diropener/
    -- tools to extract media from dxr, dcr
    http://www.macromedia.com/support/director/
    -- official MM support site
    http://www.robotduck.com/learning/introduction/introduction1.htm
    -- tutorials
    http://brennan.young.net/Edu/Lingvad.html
    -- OOP & Space Invaders game
    http://www.markme.com/mxna/index.cfm?category=Director
    –MM XML News
    http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_18629
    http://martyplumbo.com/tutor/
    -- 3D tutorials
    http://www.ullala.at/ -- IL
    widgets & cool 3D stuff
    http://www.pm-studio.pl/xtraforum/
    -- MM Xtra Developer Forum
    http://freextras.freeweb.hu/
    -- free Xtras
    http://www.easyrgb.com/math.html
    -- colour model conversion code
    http://www.farbflash.de/director/
    -- excellent examples of IL and 3D stuff
    http://www.acm.org/tog/GraphicsGems/
    -- graphics gems code repository – IL
    http://www.toxictoy.com/resources.php
    -- several introductory tutorials
    http://www.catb.org/%7Eesr/faqs/smart-questions.html
    http://www.donrelyea.com/testdept1.html
    -- some very cool scripts
    http://director-online.com/havok/
    -- havok code, demos and more
    http://www.macromedia.com/software/player_census/shockwaveplayer/version_penetration.html
    -- shockwave penetration stats
    http://www.codeproject.com/csharp/endogine.asp#xx1253907xx
    – Endongine
    http://www.macromedia.com/software/eula/third_party/
    -- third party eulas

  • Any function generating a random number ?

    Is there any function which yields a random number every time from a given list of numbers ?
    e.g.
    Consider table t as :
    invoice_no
    123
    456
    789
    654
    321
    987
    I want a function executed manually yielding a random invoice no.
    How can i achieve ?
    Regards
    Capri !!!

    Cannot reproduce. There must be some misunderstanding.
    The selected invoices are just numbered and the required number of random positions is extracted.
    Don't know how a valid position can contain a nonexisting invoice number as (valid I presume) invoice numbers were selected before being numbered.
    I think the first version was a little unfair: The last invoice couldn't be extracted as dbms_random.value(low,high) can return low but cannot return high.
    select invoice_no
      from (select invoice_no,row_number() over (order by null) the_row
              from invoices
             where <your criteria here>
    where the_row in (select trunc(dbms_random.value(1,(select count(*) + 1 from invoices)),0)
                         from dual
                        connect by level <= :how_many_to_draw
                      )Regards
    Etbin
    In my solution I overlooked the possibility that the same invoice could be extracted more than once. So better to follow Dave's suggestion and choose MichaelS's solution
    with
    invoices as
    (select trunc(dbms_random.value(:lower_limit,:upper_limit),0) invoice_no
       from dual
      connect by level <= :number_of_rows
    select invoice_no
      from (select invoice_no
              from invoices
    --          where <your criteria here>
             order by dbms_random.value
    where rownum <= :how_manyMessage was edited by:
    Etbin

  • A simple question on random number generation?

    Hi,
    This is a rather simple question and shows my newbieness quite blatantly!
    I'm trying to generate a random number in a part of a test I have.
    So, I have a little method which looks like this:
    public int getRandomNumber(int number){
            Random random = new Random(number);
            return random.nextInt(number);
        }And in my code I do int random = getRandomNumber(blah)...where blah is always the same number.
    My problem is it always returns the same number. What am I missing here. I was under the impression that nextint(int n) was supposed to generate the number randomly!! Obviously I'm doing something wrong or not using the correct thing. Someone please point out my stupidity and point me in the right direction? Ta

    I think the idea is that Random will generate the same pseudo-random sequence over and over if you don't supply a seed value. (The better to debug with, my dear.) When you're ready to put an app into production, the seed value should be the current system time in milliseconds to guarantee a new sequence with each run.
    Do indeed move Random outside the loop. Think of it like a number factory - instantiate it once and let it pump out the random values for you as needed.

  • How do I assign images to grid cells based on their random number value?

    Hello everyone!
         I need a good point (or shove) in the correct direction.
    Background
         I've created (with previous help from this forum) a 12 x 9 random number grid which cycles through the numbers 1 to 9 a total of twelve times each. I've then created a button which shuffles the current grid's cells each time it is clicked. I now want to use 9 images that I have imported as individual symbols into the library (I have given them each their own class titled "skin1," "skin2," ... "skin9") as cell labels or the equivalent. I have also set the images up as individual movie clips (using the .Sprite class as the extended base class but keeping the actual image class names in line with their object name, i.e. the "skin1" image is the "skin1.as" class).
    Question
         How do I assign these images to the grid cells based on their respective values (ranging from 1 to 9) and have them populate the grid each time I click the "shuffle" button? So for example, in my grid the numbers 1 through 9 randomly appear 12 times each. Every time the number 4 appears in a cell, I want it to be assigned to the image "skin4" (which is just a graphic that looks like a button and has a fancy number "4" printed on it). Below is a chunk of the code I am using to draw the grid cells with:
    // Creates a grid cell when called by generateGrid().
    private funciton drawCell(_numeral:int):Sprite
              This is the code I am currently implementing to populate the grids with (although I
              don't want to use text labels as I want to fill each grid with an image according
              to its numerical value (1 to 9).
         var _label:TextField = new TextField();
         _label.multiline = _label.wordWrap = false;
         _label.autoSize = "center";
         _label.text = String(_numeral);
         // Add numerical label to cell array.
         cellLabels.push(_label);
         var _s:Sprite = new Sprite();
         _s.graphics.lineStyle(2, 0x019000);
         _s.graphics.drawRect(30, 0, cellW, CellH);
         _s.addChild(_label);
         return _s;
         While the following isn't working code, it will hopefully demonstrate what I want to achieve inside this function so I don't have to use the above snippet for text labels:
         //This will "hopefully" create an array of all 9 images by calling their classes.      var _imageArray:Array = [skin1, skin2, skin3, skin4, skin5 , skin6, skin7, skin8, skin9];      // This is what I want to happen for each cell using the above image array:      for (i = 0; i < cells; i++)      {           if (_numeral == 1)           {                // Insert skin1 image for each instance of #1 in the grid.           }           if (_numeral == 2)           {                // Insert skin2 image for each instance of #2 in the grid.           }           ...           if (_numeral == 9)           {                // Insert skin9 image for each instance of #9 in the grid.           }      } 
         Again, I don't want to use text labels. I have a custom skin graphic that I want to go over each number on the grid based on its numerical value (1 to 9). Any help with this is much appreciated!

    kglad,
         Thank you for your help with this one. Using the code below, I have successfully populated my grid cells with the desired corresponding graphics. I noticed one thing though regarding my use of the shuffle button with this particular implementation: even though the numerical values residing in each cell get shuffled, the original images remain in the grid rather than being replaced by new ones. The first code snippet below is the revised cell drawing function including your help; the second snippet shows you my simple shuffle button function (where the problem lies, I think).
    Snippet #1:
         // Creates a grid cell when called by generateGrid().
         private function drawCell(_numeral:int):Sprite
              var _label:TextField = new TextField();
              _label.multiline = _label.wordWrap = false;
              _label.autoSize = "center";
              // Creates a label that represents the numerical value of the cell.
              cellLabels.push(_label);
              var _s:Sprite = new Sprite();
              _s.graphics.lineStyle(2, 0x019000);
              _s.graphics.drawRect(30, 0, cellW, cellH);
              // Physically adds the labels to the grid.
              _s.addChild(_label);
              // Assigns a graphic class to a cell based on its numerical value.
              var _classRef:Class = Class(getDefinitionByName("skin" + _numeral));
              // Undefined variable for holding graphic classes.
              var _image:* = new _classRef();
              // Lines the images up with the grid cells.
              _image.x = 30;
              // Physically adds a graphic on top of a cell label.
              _s.addChild(_image);
              return _s;
         So far so good (although I question needing text labels at all if they are just going to remain invisible underneath the images, but enough about that for now). This next part is the reason that the images won't shuffle with the cell values, I think.
    Snippet #2:
         // When shuffleButton is clicked, this event shuffles
         // the number array and fills the cellLabels with the new values.
         private function onButtonShuffleClick(e:MouseEvent):void
              // Shuffles the number array.
              shuffle(numbers);
              // Verifies the array has been shuffled.
              trace("After shuffle:", numbers);
              // Loop replaces old cellLabels with new number array values.
              for (var i:int = 0; i < cells; i++)
                   cellLabels[i].text = String(numbers[i]);
         As you can see, it never replaces the original images that populate the grid. I tried using the _s.removeChild(image) function but that didn't work, nor would copying/pasting some of the code from snippet #1 directly into this function as it would cause another instance of the images to be placed over top of the existing ones rather than actually swapping them out. Any continued help here is greatly appreciated!
         PS Is there a quicker method for posting code into these forums without having to type it all out by hand again (i.e. copy/paste or drag/drop from my .fla or Notepad file directly into this thread)?

  • What algorithm does Excel 2010 use for Pseudo Random Number Generation (MT19937?)

    Does Excel 2010+ use the Mersenne Twister (MT19937) algorithm for Pseudo Random Number Generation (PRNG), implemented by the RAND() function?
    This has been a nagging question for some time now, with "hints" that it indeed does.  However, a relatively thorough search turns up no definitive documentation.  The most direct indication is perhaps given by Guy Melard [Ref 9] where
    he tests Excel 2010's RAND() function using the Crush battery of tests in TestU01 by L'Ecuyer & Simard.  Melard references a "semi-official" indication that Microsoft did indeed implement MT19937 for the RAND() function in
    Excel 2010, but this reference no longer seems to be available. http://office.microsoft.com/enus/excel-help/about-solver-HP005198368.aspx?pid=CH010004571033.
    The other references below [Ref 1-10] document the history of the statistical suitability of the PRNG and probability distributions in various versions of Excel.  This includes the Wichmann-Hill PRNG implementations supposedly (arguably) used in
    Excel 2003 & 2007 for random number generation.  But still, we have no answer as to which PRNG algorithm is used in
    Excel 2010 (and 2013 for that matter).
    Microsoft indicates that RAND() has been improved in Excel 2010; Microsoft states, "...and the RAND function now uses a new random number algorithm." (see https://support.office.com/en-ca/article/Whats-New-Changes-made-to-Excel-functions-355d08c8-8358-4ecb-b6eb-e2e443e98aac). 
    But no details are given on the actual algorithm.  This is critical for Monte Carlo methods and many other applications.
    Any help would be much appreciated. Thanks.
    [Ref 1] B. McCullough, B. Wilson.  On the Accuracy of Statistical Procedures in Microsoft Excel 97. 
    Computational Statistics & Data Analysis. Vol. 31 No. 1, pp 27-37. July 1999.
    http://users.df.uba.ar/cobelli/LaboratoriosBasicos/excel97.pdf
    [Ref 2]L. Knüsel.  On the accuracy of the statistical distributions in Microsoft Excel 97. Computational Statistics & Data Analysis. Vol. 26 No. 3, pp 375-377. January 1998.
    http://www.sciencedirect.com/science/article/pii/S0167947397817562
    [Ref 3]B. McCullough, B. Wilson.  On the Accuracy of Statistical Procedures in Microsoft Excel 2000 and Excel XP. 
    Computational Statistics & Data Analysis. Vol.40 No. 4, pp 713-721. October 2002.
    https://www.researchgate.net/publication/222672996_On_the_accuracy_of_statistical_procedures_in_Microsoft_Excel_2000_and_Excel_XP/links/00b4951c314aac4702000000.pdf
    [Ref 4] B. McCullough, B. Wilson.  On the Accuracy of Statistical Procedures in Microsoft Excel 2003. 
    Computational Statistics & Data Analysis. Vol.49. No. 4, pp 1244-1252. June 2005.
    http://www.pucrs.br/famat/viali/tic_literatura/artigos/planilhas/msexcel.pdf
    [Ref 5] L. Knüsel. On the accuracy of statistical distributions in Microsoft Excel 2003. Computational Statistics & Data Analysis, Vol. 48, No. 3, pp 445-449. March 2005.
    http://www.sciencedirect.com/science/article/pii/S0167947304000337
    [Ref 6]B. McCullough, D.Heiser.  On the Accuracy of Statistical Procedures in Microsoft Excel 2007. 
    Computational Statistics & Data Analysis. Vol.52. No. 10, pp 4570-4578. June 2008.
    http://users.df.uba.ar/mricci/F1ByG2013/excel2007.pdf
    [Ref 7] A. Yalta. The Accuracy of Statistical Distributions in Microsoft<sup>®</sup> Excel 2007. Computational Statistics & Data Anlaysis. Vol. 52 No. 10, pp 4579 – 4586. June 2008.
    http://www.sciencedirect.com/science/article/pii/S0167947308001618
    [Ref 8] B. McCullough.  Microsoft Excel’s ‘Not The Wichmann-Hill’ Random Number Generators. Computational Statistics and Data Analysis. Vol.52. No. 10, pp 4587-4593. June 2008.
    http://www.sciencedirect.com/science/article/pii/S016794730800162X
    [Ref 9] G. Melard.  On the Accuracy of Statistical Procedures in Microsoft Excel 2010. Computational Statistics. Vol.29 No. 5, pp 1095-1128. October 2014.
    http://homepages.ulb.ac.be/~gmelard/rech/gmelard_csda23.pdf
    [Ref 10] L. Knüsel.  On the Accuracy of Statistical Distributions in Microsoft Excel 2010. Department of Statistics - University of Munich, Germany.
    http://www.csdassn.org/software_reports/excel2011.pdf

    I found the same KB article:
    https://support.microsoft.com/en-us/kb/828795
    This was introduced (according to the article) in Excel 2003. Perhaps the references in notes 2 and 3 might help.
    The article describes combining the results of 3 generators, each similar to a Multiply With Carry (MWC) generator, but with zero carry. MWC generators do very well on the Diehard battery of randomness tests (mentioned in your references), and have
    very long periods. But using zero carry makes no sense to me.
    Combining the three generators only helps if the periods of the 3 are relatively prime (despite what the article implies). Then the period of the result will be the product of the 3 periods. But without knowing the theory behind these generators, I have
    no idea what the periods would be. The formulas for MWC generators fail here.
    Richard Mueller - MVP Directory Services

  • How to get a random number in a range?

    as title
    how to get a random number in a range?
    like 2000~3000 thks :)

    int between 10 and 20 with the method Math.random():
    public class Rnd
         // Test
         public static void main(String[] args)
             int start=10, end = 30;
             for (int i = 0; i < 10; i++)
                int n = (int)(start + Math.random() * (end-start));
                System.out.println(n);
    }best regards.

  • 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

  • [JS CS3] Check the pattern of a random number given a specific data ?

    Hi all,
    I succeed getting a random number of this look : d.dd (8.73 for ex)
    I use Math.random()*(max-min)+min;
    I want to check that this number respect a specific given increment.
    To be clear :
    If I set min to 0 and max to 10 for example.
    The script returns a number like 8.56
    Now, I have a increment like 0.2
    I want the script to give me a number that can be d,d.2,d.4,d.6,d.8
    BUT NOT d.78 or d.1
    I guess I may use a while command but have no idea of the checking operation.
    Any idea ?
    Thanks in advance.
    Loic

    Math to the rescue. You want a random integer div 5.
    Math.floor(5*(Math.random()*(max-min)+min))/5 should do it.

  • How to generate a random number within a specified tolerance and control that tolerance.

    I am trying to simulate data without using a DAQ device by using a random number generator and I want to be able to control the "range" of the random number generated though.  On the front pannel, the user would be able to input a nominal number, and the random number generator would generate numbers within plus or minus .003 of that nominal number.  The data would then be plotted on a graph.  Anyone know how to do this?  Or if it's even possible?
    Just for information sake, the random number is supposed to look like thickness measurements, that's why I want to simulate plus and minus .003 because the data could be thinner or thicker than the nominal.  
    Thanks in advance!!
    Solved!
    Go to Solution.

    You can create a random number with a gaussian probability profile using two equal distributed (0...1) random numbers and applying the Box Muller transform.
    I wrote one many years ago, her it is. (LabVIEW 8.0). 
    Message Edited by altenbach on 04-12-2010 09:13 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    BoxMuller.vi ‏10 KB

  • Is there any way to generate random number in CPO

    Requirement : -
    > I want  to generate a random number from set of 1-9 numbers .is there any way in cpo ?
    Thanks
    Siva

    I created a process that uses 3 steps, all of which happen inside the engine rather than having to span out to a script, so it runs a lot faster.
    Technically, it's pseudo-random...
    Predefine Output Variable "Random Number" as type "Numeric"
    Step 1:  Format Date
      Format string: fffffff 
        (that's seven lower-case letters "f")
      Original date: [Process.Start Time]
    Step 2: Format Date
      Format string: ff\0\0\0\0\0
      Original date: [Process Start Time]
    Step 3: Set Variable
      Variable to update: [Process.Variables.Output.Random Number]
      New value: ([Workflow.Format Date.Formatted Date]-[Workflow.Format Date (2).Formatted Date])/100000
    This returns a basically random number between 0 and 1 (so you can mulitply it by your maximum value) based on the numeric fraction of a second of the start time of the process.

Maybe you are looking for

  • Acrobat Pro 9, blank lines in text boxes vanish upon save

    Folks, Since I upgraded from Acrobat Pro 8 to 9, whenever I put blank lines in a text box, the blank lines disappear as soon as the PDF is saved. Here's an example: - Open a PDF file - Click on text box tool in the toolbar (or from menu Comments->Com

  • Image instead of broken Flash icon

    Hello all. Does anyone know if there is a way to show a jpeg image while a Flash file is loading or better, if they don' t have Flash? Problem is that when people go to a site and they don't have Flash and can't install it (ie: iPhone), they can't se

  • Dynamically updating a spread-sheet repor t daily

    After demoing APEX to some users a request of the following was made. There is a spreadsheet that comes from a remote site daily and shared amongst a small work group. I would like to automate this into an APEX web page. I would like to take the spre

  • Re problem backing up all photos saved in Iphoto

    Hello I have recently added an extrenal hard drive to use with time machine so I can back up my whole Mac, but most importantly photos. I seem to have done this sucessfully but when I check I cannot seem to find the photos. They are always in Iphoto

  • HT4623 I can download videos in Youtube but when I try to play them nothing happens.

    I can download videos in Youtube, but when I try to run them, nothing happens. Any suggestions?