Node:PRNG Example, Previous:UMacGenerator, Up:Random Numbers



PRNG Example

     Map attrib = ...;
     IRandom rand = PRNGFactory.getInstance("MD");
     
     attrib.put(MDGenerator.MD_NAME, "MD5");
     attrib.put(MDGenerator.SEEED, seedBytes);
     
     random.init(attrib);
     
     for (int i = 0; i < bytes.length; i++)
        {
           in[i] ^= random.nextByte();
        }
     
     random.nextBytes(bytes, 0, bytes.length);