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

Similar Messages

  • How to generate a random number with at least 6 digits?

    Hi all,
    All is in the question. :-)
    I would like to generate a random number but the function "random
    number" in Labview isn't accurate enough.
    Do you know an algorithm to generate a random number of 6 or more
    digit?
    Thanks,
    PF

    Hi PF,
    It's simple. Use 2 random number functions in the same process. Now you
    should have 2 distinct random numbers that have the same accuracy. Let's say
    LV gives accuracy up to the thousandth (0.XXX), now if you divide one number
    by 1000 and then add to the other number you should then have something like
    0.XXXXXX. Actually, LV random number function can give up to about 17 digits
    (decimal). If you are looking for more digits (>17 digits), the idea above
    may not work, then the last thing you may want try is to generate two or
    three random numbers then convert all these decimal numbers to fractional
    strings chop off the 0 and dot then concatinate them together. After all
    it's still a random number. How many digits do you want to get? Make sure
    the indicators acce
    pt that many digits?
    Good luck
    Louis.
    P-F wrote in message
    news:[email protected]..
    > Hi all,
    >
    > All is in the question. :-)
    >
    > I would like to generate a random number but the function "random
    > number" in Labview isn't accurate enough.
    >
    > Do you know an algorithm to generate a random number of 6 or more
    > digit?
    >
    > Thanks,
    >
    > PF

  • How can you generate a random number?

    Say I have a timer, and I need it to choose a random number between 100 and 1000. How would I do that?
         timer.delay(***RANDOM***);Thanks!

    I have this, and it's working for me:
    int j = rand.nextInt(500);
    But I actually want it to generate a random number between 100 and 500, not 0 and 500. How could I do this?
    ~Dac

  • How generate a random number that is between 0 and 15! (0-15)

    how generate a random number that is between 0 and 15 ??? (0-15)
    pls tell me, thx!!!!!!!!!!!!!!!!!

    import java.util.Random;
    Random r = new Random();
    int mynumber = r.nextInt()%16;
    For (2^1)-1 number use:
    -> int mynumber = r.nextInt()&15; // speedup

  • How to Build a VI that generates a random number between 1 and 80 ....Help!!!!

    Build a VI that generates a random number between 1 and 80 
    Divides the random number by a number specified in the front panel.
    If the inputted number is zero, the VI program should turn on a LED in the front-panel to indicate a divide by zero error.
    Solved!
    Go to Solution.

    One quick question Edward, was the answer just in time for your monday morning class.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • How to generate pseudo random noise(PRN) binary sequence using shift registers?

    what is the block diagram to generate pseudo random noise (PRN) binary sequence of 1's and 0's using shift registers
    please help
     i need 2 submit this project in this week

    This is a fairly simple homework problem. My hints (on the LabVIEW side):
    1- look at while loops
    2- look at shift registers on while loops with multiple input elements
    3-look at the logic components, AND, OR XOR
    Look at this wiki article: http://en.wikipedia.org/wiki/Linear_feedback_shift_register
    Do the work, you won't learn if someone shows you how it is done! The palette that the previous post points to are of PRN and other "noise generators" but I suspect that is not what you are after.
    Know that creating a PRN with a reasonable number of shift register taps produces very pseudo results, as the "random" pattern begins to repeat pretty quickly, thereby making it not a truly random number. 
    When you have an attempt that is sort of working and want additional suggestions, post the code here. We won't do your work, we will help you try to do it, and learn it, yourself.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • How to generate n random dates between 2 time periods

    Hi,
    I'm trying to write a method that generates n random dates between 2
    time periods. For example, lets say I want to generate n random dates
    between Jan 1 2003 and Jan 15 2003. I'm not sure how to go about
    doing the random date generation. Can someone provide some direction
    on how to do this?
    The method signature should look like this.
    public String[] generateRandomDates(String date1,String date2,int n){
    // date1 and date2 come in the format of mmddyyyyhh24miss.
    // n is the number of random dates to generate.
    return dateArray;
    Thanks.
    Peter

    first take a look at the API concerning a source of randomness (Random might be a good guess), then take a look at stuff concerning dates (Date might be cool, maybe you will find some links from there).
    Who wrote this stupid assignment?

  • Generate a random number

    How do you generate a random number?

    You can also check out Math.random() which returns a
    double value between [0..1)You could, depending on your needs, but if you do want ints then you're better off using nextInt from java.util.Random, as outlined by the author here:
    http://java.sun.com/docs/books/effective/excursion-random.html
    (and what was wrong with 125?! I thought that was a perfectly fine random number...)

  • 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.

  • How to generate new perner number using Abap Code in pa0002. what is the fu

    how to generate new perner number using Abap Code in pa0002. what is the function Module used.

    hi
    define internal number ranges for ur implementation then when u run PA 40  do not input any employee number , system will generate the employee number automatically.
    Regards
    sameer

  • Urgent How to generate a random code such as registration code?

    I would like to ask that how to generate a random code?
    For example, when you register a E-mail account, you need to enter the code for activation. I would like to create a java Bean to do this job. Would you help me?

    In fact, I would like to set a 10 digi codes randomly (such as FH654CS081, MKO624VG9f) for user input when they register the forum account. This random code will be sent to the user's email. User have to input this code to a JSP web site. Also, the code which is inputed by user will be matched with the database. If user input success, the forum account will be activated.
    By generating this 10 digi codes, I want to handle this generation by using java bean.
    1) Any thing else i need to import ? (such as <% page import="java.......?")
    2) Any functions can handle this task?
    3) Any example can be my reference?
    Thank you very much

  • How to generate a random session variable in php

    i want to generate a random session variable and insert the variable in a mysql record to use later to validate an account set up.
    person fills out form to create account and submits; inserts form information in mysql record.
    i want the random variable to be inserted from a hidden field and the page sends an email with a link to click on to compare the variable to validate the user.
    Not sure how to generate a random session variable and get that to the hidden field value to be inserted with the other form information.
    thanks for your help,
    Jim Balthrop

    To insert the key I would personally do something like...
    $key = md5($username . $password . $salt);
    Insert that into your MySQL database, then send them a email with it, my next code shows how to activate it.
    This is to activate the account.
    <?php
    $key;
    $errors = array();
    if(isset($_GET['key']){
         $key = $_GET['key'];
         $sql = 'SELECT * FROM users WHERE key = \'' . $key '\' LIMIT 1';
         $result = mysql_query($sql) or die(mysql_error());
         if(mysql_num_rows($result)){
              $sql2 = 'UPDATE users SET active = 1 WHERE key = \'' . $key '\' LIMIT 1';
              $result2 = mysql_query($sql2) or die(mysql_error());
              if($result2){
                   //successfully activated account
              else{
                   //Something Went Wrong!
         else{
              $errors[] = 'Invaild Key, Please try again!';
    else{
         $errors[] = 'Invaild Key, Please try again!';
    ?>

  • 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

  • Random number within TWO ranges

    Is there anyway to select a random number within TWO ranges ? For example, a random number between the range (10 to 50) OR (100 to 200).
    Thank you !

    This is a simple class that produces a number between a range:
    class RandomRange
    static java.util.Random random= new java.util.Random();
    *    Return an int between n1 and n2
    static int getIntBetween(int n1, int n2) // n2 must be greater than n1 or n2-n1 must be positive
    // get random number between 0 and the range(n2 - n1)
    int result= random.nextInt(n2- n1);
    // plus the offset
    result += n1;
    return result;
    // return random.nextInt(n2 - n1) + n1;
    // the result is n2 exclusive, to make it inclusive return (result + 1)
    *    Return a double between d1 and d2
    static double getDoubleBetween(double d1, double d2)
    return random.nextDouble()*(d2 - d1) + d1;
    // d1 and d2 can be any value
    *    Return a float between f1 and f2
    static float getFloatBetween(float f1, float f2)
    // similar
    }----------------------------------

  • How do we decide the number of data base servers and application servers ?

    Dear Gurus,
    How do we decide the number of data base servers and application servers in BW ?
    How does this number help in data load balance and reporting needs ?
    Any hard n fast rule in the number of servers ?
    Regards
    Mohan

    Hi Mohan,
    Check the number of application server in the T-code SM66.... and also u can check the it in Sm50 on appplication server basiss./.
    From Sm37 u can see the application server Push button.. if u click on that also.. u can see the number of application servers in the system..
    Get into the individual application server and check how many Dialogue and background WP's are free,,
    If u see that the considerable number of WP are free(Waiting for task).. then u can shedule the loads..
    If most of the WP are  busy then u need to wait to trigger ur loads to maintain the load balancing..
    If one Application server is too busy then u can check the other Application Servers in the systems..
    And u can shedule the loads on a specific application sever level as well using the PC..
    Thanks
    I hope this is clear to u..
    Assign points if this helps

Maybe you are looking for