Examples of Fortuna


Examples of se.grunka.fortuna.Fortuna

        }
        long dataSize = megabytes * MEGABYTE;
        long remainingBytes = dataSize;
        byte[] buffer = new byte[MEGABYTE];
        System.err.println("Initializing RNG...");
        Fortuna fortuna = Fortuna.createInstance();
        System.err.println("Generating data...");
        OutputStream outputStream = new BufferedOutputStream(output);
        try {
            while (remainingBytes > 0) {
                fortuna.nextBytes(buffer);
                outputStream.write(buffer);
                remainingBytes -= buffer.length;
                System.err.print((100 * (dataSize - remainingBytes) / dataSize) "%\r");
            }
        } finally {
View Full Code Here

Examples of se.grunka.fortuna.Fortuna

                usage();
                System.err.println("Height is not a number: " + args[1]);
                System.exit(1);
            }
            System.err.println("Initializing RNG...");
            Fortuna fortuna = Fortuna.createInstance();
            System.err.println("Generating image...");
            BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
            for (int x = 0; x < width; x++) {
                for (int y = 0; y < height; y++) {
                    image.setRGB(x, y, fortuna.nextBoolean() ? 0xffffff : 0x000000);
                }
            }
            String extension = args[2].substring(args[2].lastIndexOf('.') + 1);
            ImageIO.write(image, extension, new File(args[2]));
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.