QCPatch 'Random Generator' Broken Seed?

Hi there all,
Just putting this out there - perhaps I'm wrong, but want some other QC developers who are more experienced to compare with.
Quartz Composer Patch "Random Generator" - one of the inbuilt patches available.
Its purpose is to generate random numbers between a range, and supply the number on its output port.
To this end, it works fine.
My problem with this patches behavior occurs when it is nested in a macro patch, and that patch is then duplicated (purpose obvious).
*The duplicated macro patch appears to also copy the Random Generators' base seed.*
For example I have the same picture resulting from Random Generators nested inside a macro patch that contains processing for a random choice of image to a sprite.
The only way i could work around this (and this may help others with the same problem) was to Publish the Input ports all the way up to the root level patch, and supply new instances of a Random Generator for each instance of the duplicated macro patch.
Then I received fresh random seeds from the generator and different images were selected for output to my nested sprite.
Awfully inconvenient given that each macro had 4 levels of nesting using objects like render in image, 3D transformation and Lighting - all patches that require nesting, and also reset your ports being passed to a parent, meaning you have to - 're-map' the Published Inputs with every layer of nesting. Not to mention the fact that the root level of the document is cluttered all to **** with millions of Random Generator patches.
Anyone get this behavior?
Please let me know if I'm just screwing my design up, or if this is encountered by you too and we should report it as a bug. (Ive only been devving QC for several weeks straight, so I'm want to actually report it as a bug yet).
Many thanks in advance,
Wilks.

A random created with the same seed will give the same set of random numbers.
Take out the Random creation from the loop
try
             BufferedWriter out = new BufferedWriter(new FileWriter("c:/test.txt"));
                //Create Random here.
                 Random r = new Random( );//No need for any seed
             for (int i = 0; i < 1000; i++)
                  out.write(String.valueOf(r.nextInt(9)));
             out.close();
catch (IOException e)
[url http://www.feedfeeds.com/feedtv]Feed Your Feeds

Similar Messages

  • Seeding the random generator

    I have program that uses random but each time i start the program i get the same sequence. I need to seed and start the rnd-generator but java doesnt support true random. Can anyone tell where i can find such a generator?

    True randomness requires a hardware solution that takes input from physical processes (such as radio "white noise"). I think somebody said that certain PCs or chipsets have such hardware, but in general you won't have that option available to you.
    java.util.Random and Math.random use a seed you provide, or the system clock if you don't provide a seed. If you use the same seed twice, you'll get the same sequence of numbers both times.
    One common error when generating random numbers is to reseed the generator each time in a loop. For instance for (int ix  0; ix  < 100; ix++) {
        Random rand = new Random();
        int i = rand.nextInt(10);
    } This will probably produce the same number 100 times, or maybe one number N times and another number 100 - N times. The reason is that every time you create a new Random that way, you're seeding it with the system clock and starting from that sequence's first number. The system clock doesn't have time to change, or maybe changes once, during the time it takes to run through one loop iteration, so you keep starting the same sequence over, or maybe get the first number of two different sequences. The solution is to move the new Random() outside the loop. If it were a member variable, you'd probably want to make it static.
    The above doesn't sound like your problem, but I present it because the solution to the problem you are having could lead to the above situation.
    As someone already said, if the problem is that you get the same sequence on multiple runs of the program, then just use the system time to seed the PRNG, either explicitly or by not specifying a seed. As long as it takes at least 10 ms between one program startup and the next, you'll get different sequences.
    Finally, you might want to look into [url http://java.sun.com/j2se/1.4.2/docs/api/java/security/SecureRandom.html]SecureRandom. It has better random properties than java.util.Random or Math.random, and I think if your computer does have true random hardware attached, it will use that, or can be told to use it.
    &para;

  • Does Random with zero seed work ?

    halo everyone..
    i am new to this site.. and im very new to java too.
    anyways.. i am so stomped.. how can i make a
    random constructor to accept a zero seed and still
    generate a random number ?
    coz when i try like
    Random generator = new Random(0);
    all my generated integers stay the same..
    not random at all.
    i tried to use DecimalFormat to try and work around
    this problem.. but still it doesn't work for me. i would like
    to know if this is possible to have zero seed. thanx

    You must be using it incorrectly. You're probably doing something like this: for (...) {
        Random rand = new Random(0);
        int value = rand.nextInt();
    } You need to do this: Random rand = new Random(0);
    for (...) {
        int value = rand.nextInt();
    } Or, if rand is a member variable in your class, make it static, so all instances share the same Random.
    If you create multiple Randoms with the same seed, they'll all have the same sequence of pseudorandom numbers. If you only use each one once, you'll always get the first number in that sequence.

  • Randomly Generated Pixels

    Hi!
    I want to create a script that creates random (or near random) values for every single pixel of a document, similar to the "Add Noise..." filter, but with more control, such as "only b/w", "only grey", "all RGB" and "all RGB with alpha" and maybe even control over the probability distribution. Any idea how this could be tackled? Selecting every single pixel and applying a random color seems like something that would take a script hours...
    Why do I need this?
    I've started creating some filters in Pixel Bender (http://en.wikipedia.org/wiki/Adobe_Pixel_Bender). Since Pixel Bender doesn't really have any random generator (and workarounds are limited) I'm planning on passing on the random numbers through random pixel values. I'm well aware that this can only be used for filters in which Pixel Bender creates images from scratch, but that's the plan.
    Thanks!

    Understanding the details of the Add Noise filter is probably beyond the scope of just a short post.  Here is an approach to start learning what it does.
    - Take a 50% gray level and make it a Smart Object.
    -  Open up the historgram panel (should show a spike right at 50%)
    - Apply noise filter to Smart Object in monochrome building up from small percentages in small increments
    - You will notice that for this option above, you end up with a uniform probability function over the entire tonality spread at 50% applied for uniform distribution.
    There are a variety of ways to manipulate this function, through various blends.
    Please note a couple things
    1) I am using CS5 and though not documented anywhere that I have seen, the Noise Filter does work different than in CS4.  In CS4, if you run the same noise filter twice on two identical objects, my experience is that you get the identical bit for bit result ( a random pattern yet not independent of the next run of the filter).  Manipulating Probability Density Functions (PDFs) per my previous post requires that each run of the Noise Filter starts with a different "seed" so that the result is independent of the previous run.  CS5 does this where succesive runs will create an independent noise result.
    2) PS does not equally randomize R, G, and B.  There are ways to get around this yet wanted to give you a heads up.
    3) There are other ways to generate quick random patterns outside of PS and bring them in (using scripts).   You would need to understand the format of the Photoshop Raw file.  This type of file contains bytes with just the image pixel data.  These types of files are easy to create and then load into PS. From a script (or even faster call a Python script) create this file and then load it into PS as a Photoshop Raw format file and use as an overlay.  There is not question that this is faster than trying to manipulate individual PS pixesl through a script.
    4) Please not the under Color Settings there is an option called Dither.  If this is set, there are  times where PS adds nosie into the image (I leave mine turned off).  If is used in a number of places in PS other than what the documentation implies (more than just when moving between 8 bit color spaces)
    Good luck if you are going after making a plug-in.  I have never invested in that learning curve.  Good luck.

  • Period of Java's random generator

    Hi.
    I am trying to find out how long period the java generator has. I havent been able to find this info anywhere, even though I searched paper indexes, google, java.sun etc.
    It looks like the random generator uses 2^48 for modulus. And I read somewhere that the multiplier is 0x5DEECE66DL, but this info is unsure. I don't know the increment factor either. With this info it would be possible to calculate the period, if it is not given.
    I would appreciate any information about this.
    Espen Sigvartsen
    [email protected]

    Have you checked out the source code for Random? It shows some of values you mention. Below is a snp of the source code. You should check it out it may provide some of the anwsers you are looking for...
        static final long serialVersionUID = 3905348978240129619L;
        private final static long multiplier = 0x5DEECE66DL;
        private final static long addend = 0xBL;
        private final static long mask = (1L << 48) - 1;
        synchronized public void setSeed(long seed) {
            this.seed = (seed ^ multiplier) & mask;
          haveNextNextGaussian = false;
        synchronized protected int next(int bits) {
            long nextseed = (seed * multiplier + addend) & mask;
            seed = nextseed;
            return (int)(nextseed >>> (48 - bits));

  • Normal random generator

    Hello,
    Can I customize "normal random generator" to have a input for seed unless a parameter data? In both, "block" and "block script" solution a only can use seed like a parameter.
    Thank´s in advance.

    OK.
    OBJECTIVE: Create several dll for models using a Normal Random Generator Block
    ACTION: Change the "PARAMETER SEED" to a "INPUT SEED". This way, I will config the dll without need a new compilation with diferent seed parameter adjusted for each dll.
    Thank´s.

  • How to create a new user in IDM 8.1 with random generated password?

    Hi, i want create a new user using a modified tabbed user fom that cannot ask for password and confirm password to the administrator but randomly generate a new password (only when the form is opened in user creation) according to password policy and display it on the form.
    I think it is possible because Reset User Password Form does it, but i don't know how put this kind og logic in an other form.
    thanks
    Marco

    If you want to generate a users password randomly then you could take a look at the com.waveset.provision.PasswordGenerator class inside the Identity Mgr REF kit. Here's an example:
    <Rule name='generateRandomPassword'>
           <Comments>generate a random password</Comments>
           <RuleArgument name='accountId' value='Configurator'>
             <Comments>accountId of the user</Comments>
             <String>Configurator</String>
           </RuleArgument>
           <RunAsUser>
             <ObjectRef type='User' id='#ID#Configurator' name='Configurator'/>
           </RunAsUser>
           <block trace='true'>
             <defvar name='session'>
               <or>
                 <ref>context</ref>
                 <ref>display.session</ref>
               </or>
             </defvar>
             <defvar name='wsuser'>
               <invoke name='getObject' class='com.waveset.ui.FormUtil'>
                 <ref>session</ref>
                 <s>User</s>
                 <ref>accountId</ref>
               </invoke>
             </defvar>
              <defvar name='pwgenerator'>
               <new class='com.waveset.provision.PasswordGenerator'>
                 <ref>session</ref>
               </new>
             </defvar>
             <invoke name='generatePassword'>
               <ref>pwgenerator</ref>
               <ref>wsuser</ref>
             </invoke>
           </block>
        </Rule> You'll want to take the password.password field and inside the Default event handler check to see if waveset.id is null, if it is then call the Rule above.
    HTH,
    Paul

  • Identity Sync - Password randomly generated in AD

    Configuration:
    DS 5.2 Patch 2
    on Solaris 9
    with Identity Sync for Windows 1 2004Q3
    configured to Synch from DS to AD
    I have set up object creation to flow from DS to AD, and the user creation works okay but the password I create the account with is not being pushed to AD. Instead it creates the account with a randomly generated password. Is there a way around this, I am attempting to script new user creations. Here is log entry I get in error.log when I create a user.
    [08/Mar/2005:11:35:59.416 +1000] WARNING 29 CNN101 tyr "Successfully created user cn=James Test,cn=users,dc=xxx,dc=xxx,dc=xx with randomly generated password. This account will be unusable until another password is set." (Action ID=CNN100-1027FA4BBD3-491, SN=2)
    Thankyou in advance for any assistance!!
    regards
    Gryph

    I've been doing some more testing and have some more information that might be important.
    I have been testing the attribute synchronisation for the mappings I have done, and noticed that if I modify the userpassword attribute in the DS console it is not being synch'd to AD, but I can modify other attributes and they do get synch'd. If I modify the password on the AD side it gets synch'd back to DS ok. I have attribute modification set to flow in both directions and the password mapping is (DS) userpassword <--> unicodepwd (AD).
    Given it seems to ignore changes to the userpassword attribute for modifications, it looks like this is also holding true for creations, and I guess this is why it's randomly assigning a password.
    Any ideas why it sees other attribute modifcations and synch's them from the DS side, but is not seeing the userpassword attribute?
    Regards
    Gryph

  • How to use the random generator in java

    hey peeps, this is the class in which i am trying to implement the random generator in;
    public class Matchlist
        private studentdetails sd = new studentdetails();
        /** matchList StringBuilder stores the match list in progress */
        private StringBuilder matchList = new StringBuilder();
        private int loop = 0;
        private int matches = 0;
        public Matchlist()
            sd.createstudentdetails();
        /** Method to create the actual match list, returns the list as a string */
        public String CreateMatch()
            int g;
            int y;
                for (g = 0; g < 4; g++)//g = game
                    for (y = 17; y > -1; y--)//y = green house
                        /** Check to see if the game is empty */
                        if (sd.getgh(y).getGame(g).equalsIgnoreCase(""))
                            for (int x = 0; x < 18; x++) //x = yellow house
                                if (sd.getyh(x).getGame(g).equalsIgnoreCase(""))
                                    if (sd.getgh(y).getC_lass() != sd.getyh(x).getC_lass())
                                        /** Check to see if the person has played the other person */
                                        if (sd.getgh(y).checkPlayed(sd.getyh(x).getName()) == false)
                                            /** Set the game to the name of the opponent played */
                                            sd.getyh(x).changeGame(g, sd.getgh(y).getName());
                                            sd.getgh(y).changeGame(g, sd.getyh(x).getName());
                                            /** Build the match list step by step using append with \n at the end to create a new line */
                                            matchList.append(sd.getyh(x).getName() + " vs " + sd.getgh(y).getName() + "\n");
                                            matches++;
                                            break;
                /** Convert the stringbuilder into an actual string, then return it */
                String completeMatchList = matchList.toString();
                System.out.println(matches);
                for (int i = 0; i <18; i++)
                    sd.getyh(i).getEmptyMatches();
                    sd.getgh(i).getEmptyMatches();
                return completeMatchList;
        }what i dont understand is how to implement it to pick my matches at random using the http://java.sun.com/j2se/1.4.2/docs/api/java/util/Random.html java tutorials from here
    regards

    How to use Random ?
    First you open API then you read it, then you use it.
    You mention you try to use it but i just see a horrible nested for for for if if if loop.
    Restructure code and question and maybe it makes more sense.
    Edited by: pgeuens on 10-mrt-2008 22:58

  • How to make a random generator with a max and a minimum

    hello
    can anybody telle me how to make a random generator for numbers with a maximum and minimum input
    thanks in advance

    Hi suske,
    If you want a random day for a given month, this is how I would do it.
    Hope this helps,
    -D
    Message Edited by Darren on 02-02-2006 01:35 PM
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman
    Attachments:
    Days_per_month.jpg ‏32 KB

  • How to setup /dev/random to SSL seed no. in JDK 1.4

    In order to speed up the SSL encryption and reduce CPU resources in WebServer, pls let us how to setup/define the /dev/random for SSL seed no in JDK 1.4 on Solaris 8 (Latest Patch).
    Current Setup:
    H/W:
    + Sun V880 with 2 x 1.2GHz US-III CPU, 2GB RAM
    S/W:
    + SunOne Web Server 6.1 SP1
    + Solaris 8 (latest patch) support /dev/random
    + JDK 1.4
    Rgds,
    William

    You may get a better response posting this question to one of the security forums, specifically:
    http://forum.java.sun.com/forum.jsp?forum=2
    http://forum.java.sun.com/forum.jsp?forum=60
    You could also try the App server product forum:
    http://swforum.sun.com/jive/category.jspa?categoryID=30

  • Writing a class using random generator in bluej

    Hello
    Im trying to write a class for a deck of cards. Im using a random generator but I dont know how to write the instance variable.
    I have to make 4 suits heart, club, spade, dimonds. and 13 for face value. I know how to random generate numbers. Like if I were making a slot machine to give me 3 numbers in a rage from 0-10. Thats just numbers. How do I random generate values of 1-13 and have it output a random suit? Also how do I make it say if its a jack king or queen? Do I need a constructor or how would I make the card with the face value of 13 suit heart and the card be a queen.
    before jumping down my throat about this being a homework assignment...yes it is but this step Im seeking help on there is no example for this type of generating.
    Thanks for any help
    Rewind

    Well, this is far from bullet-proof, but I think gets the basic idea across. This does sampling with replacement; if you wanted to do something like shuffle a deck of cards you'll need a smarter approach than this.
    import java.util.*;
    public class RandomCards {
      public static void main(String[] args) {
        Suit suit=new Suit();
        for (int i=0; i < 10; i++) {
          System.out.println(suit.nextSuit());
      private static class Suit {
        public static final String HEART="Heart";
        public static final String DIAMOND="Diamond";
        public static final String SPADE="Spade";
        public static final String CLUB="Club";
        private final String[] SUITS={ HEART, DIAMOND, SPADE, CLUB };
        private Gen suitGen=new Gen(0,3);
        public String nextSuit() {
          return SUITS[suitGen.nextInt()];
      private static class Gen {
        private int floor,ceiling;
        private Random rand;
        public Gen(int floor, int ceiling) {
          this.floor=floor;
          this.ceiling=ceiling;
          rand=new Random();
        public int nextInt() {
          return rand.nextInt(ceiling-floor)+floor;

  • Random generated number along with barcode in smartforms

    Hi All,
    Is it possible to add some random generated number by system to add along with the end of the barcode in smartforms. (what could be the field) If so how it can be done. Tanks in advance
    Regards
    GK

    Hi Tankx man 4 the valuable reply,
         I am able to get that, but what my problem is,
    Eg: In my GR a item with 10 qty, so i made the qty as input and based upon that i am printing 10 labels. for ur ref the code is below"
    menge = TRUNC( is_mseg-menge ).
    DO menge TIMES.
    header-slno = header-slno + 1.
    APPEND header TO itab.
    the complete program is like as follows;
    menge = TRUNC( is_mseg-menge ).
    DO menge TIMES.
    header-slno = header-slno + 1.
    APPEND header TO itab.
    CALL FUNCTION 'QF05_RANDOM_INTEGER'
    EXPORTING
    RAN_INT_MAX   = '999999999'
    RAN_INT_MIN   = '100000000'
    IMPORTING
    RAN_INT       = RANINT
    EXCEPTIONS
    INVALID_INPUT = 1
    OTHERS        = 2.
    IF SY-SUBRC EQ 0.
    ENDIF.
    WRITE :/ RANINT.
    ENDDO.
    but in my barcode all the label has the same random number, can u say how to solve this.

  • SPro | SQR APY1060 is randomly generating Corrupted PDF's

    Hi,
    We're in the process of implementing SPro FSCM 8.9 on 8.47.11 for one of our clients. While the running the OOB SQR APY1060, we've found that the SQR randomly generates corrupted PDF. When we run the Process again, it works fine...Its is also difficult to replicate in other environments.
    Has any body faced an issues like this earlier with any PS delivered SQR.
    We've been able to zero in on the culprit - Control-M ... We've noticed a pattern, using the same run control ID, if we run it (PSJob) using the online page, then the PSJob runs absolutely fine. However, when we schedule it through Control-M the corruption happens. Also, if we create separate Process Requests in Control-M to schedule individual processes rather than the OOB PSJob, the SQR runs fine...Not sure if some one has come across such an issue...
    Thank You
    Prashant
    Edited by: PSFT_PP on Feb 9, 2009 8:47 AM

    I am not sure about this..but do you have different run control for the different OS or the same run control. Unix always recognises CAPS runcontrol values. do a check on that please.

  • Randomly generate an ID for SQL Create Table command

    Hi,
    I need help to randomly generate an integer, which i can use as a primary key for the ID of a table field. I have no idea how to do this so that it generates a different number every single time.
    Right now it just increments the ID by 1. Maybe, is there a way to get the last ID value of the table field and then increment starting from that one? thanks

    Your analysis is flawed! One of my main reasons for
    doing this is to reduce the load on the db server. I
    don't have to go to the db to get an id every time I
    need one. Every now and again (usually less than one
    in a 2000) I have to repeat an insert operation.
    You already stated that this was the reason, so I used that as part of my assessment. With most, perhaps all databases, the ability to increment a key is done as part of the insert operation. It requires no additional 'trip' to the database to get the ID. There is so much wrong with your idea, I hardly know where to start. I wouldn't be so firm except you stated that you do this all the time. Even using it once is very questionable I wouldn't want this idea to profilerate to other peoples systems without comment.
    You also said:
    On one project I was having to place usage transaction records
    into a database with each one needing an ID. I started using your
    technique but it was taking almost as much time as the insert of
    each transaction into the database.I agree, and I think dcminter agreed that there are less expensive practices then max(fld)+1 which are in fact using the vendor specific capabilities. However, if this was taking as long as your insert, there was probably something else wrong. For example, if the field you are getting the max value for isn't indexed, or isn't the first field in a contatenated index (an index of multiple fields), then some databases (there are exceptions like redbrick) will require either a full table scan, an index scan or an ackward index lookup to give back the max value. It shouldn't be that way, but it is and you have undestand how your database is resolving max() in order to make the best decisions.
    I stand by analysis and I would suggest that rather then use your method "all the time" that you save it for that unusual situation where nothing else will work for you.

Maybe you are looking for

  • Does 1Z0-001 fit the requirement of 11g DB OCP requirement (1Z0-051)?

    Dear Sir:    Hi, I would like to ask 3 questions about the certification requirement of 11g DB OCP. Please advice me what do I have to do to prepare the OCP exam, thanks a lot in advance. Q1: Does 1Z0-001 fit the requirement of 11g DB OCP requirement

  • USB Adaptor for older char

    Hi, I have a new ZEN player. The complete AC adpator is $29.99 plus shipping. All it is, is a 5 volt charger like the one I have for my nomad 2, nomad Zen Xtra and nomad Zen touch plus an USB adaptor. Well, I have lots of the old 5 v 2.4 amp wall cha

  • Chnage log for classisication data of material

    Hi All, From last two day's i have trapped with this problem. We have requirement where we have to send IDOC to our EDI partners for any change in material master data and calssification data of material. We will run a batch say every day which will

  • SAP GUI 7.20 Patch 9 Update failed

    Hello, I have patched my Intallation Server with Sap GUI 7.20 Patchlevel 9.4, but the automatic workstation updater fails on the local workstation. Every time when I start SAP GUI it will be updatet ("an update is avaliable on the installation source

  • OS X Tiger and The Gimp

    I have installed the software The Gimp but when trying to open it, it asks for apple's X11, I found it on the Mac OS X Tiger install DVD and correctly installed apple's X11, but The Gimp goes on asking for Apple's X11. Does anybody know why ? Many th