Package java.util

Examples of java.util.Random.nextFloat()


      arr = new MutableSparseFloatArray(new float[orig.length]);
      int[] idxs = new int[1024 * 1024];
      float[] vals = new float[idxs.length];
      for (int i = 0; i < idxs.length; i++) {
        idxs[i] = r.nextInt(orig.length);
        vals[i] = r.nextFloat();
      }

      long markTime = System.currentTimeMillis();
      for (int i = 0; i < idxs.length; i++) {
        orig[i] = vals[i];
View Full Code Here


    try {
      float[] orig = new float[32 * 1024 * 1024];
      float density = 0.4f;
      Random rand = new Random(SEED);
      int idx = 0;
      while (rand.nextFloat() > density) {
        idx++;
      }
      int count = 0;
      while (idx < orig.length) {
        orig[idx] = rand.nextFloat();
View Full Code Here

      while (rand.nextFloat() > density) {
        idx++;
      }
      int count = 0;
      while (idx < orig.length) {
        orig[idx] = rand.nextFloat();
        count++;
        idx += 1;
        while (rand.nextDouble() > density) {
          idx++;
        }
View Full Code Here

        while (iter.hasNext()) {
            Entity target = (Entity) iter.next();
            if (target.isEntityAlive()) {
                if (target.worldObj.getTotalWorldTime() % 5 == 0) {
                    Random rand = new Random();
                    target.setVelocity(rand.nextFloat() - .5, rand.nextFloat(), rand.nextFloat() - .5);
                    ThaumicTinkerer.tcProxy.burst(target.worldObj, target.posX, target.posY, target.posZ, .5F);
                }
            }
            if (target.worldObj.getTotalWorldTime() > airPotionHit.get(target) + 20) {
                iter.remove();
View Full Code Here

        while (iter.hasNext()) {
            Entity target = (Entity) iter.next();
            if (target.isEntityAlive()) {
                if (target.worldObj.getTotalWorldTime() % 5 == 0) {
                    Random rand = new Random();
                    target.setVelocity(rand.nextFloat() - .5, rand.nextFloat(), rand.nextFloat() - .5);
                    ThaumicTinkerer.tcProxy.burst(target.worldObj, target.posX, target.posY, target.posZ, .5F);
                }
            }
            if (target.worldObj.getTotalWorldTime() > airPotionHit.get(target) + 20) {
                iter.remove();
View Full Code Here

        while (iter.hasNext()) {
            Entity target = (Entity) iter.next();
            if (target.isEntityAlive()) {
                if (target.worldObj.getTotalWorldTime() % 5 == 0) {
                    Random rand = new Random();
                    target.setVelocity(rand.nextFloat() - .5, rand.nextFloat(), rand.nextFloat() - .5);
                    ThaumicTinkerer.tcProxy.burst(target.worldObj, target.posX, target.posY, target.posZ, .5F);
                }
            }
            if (target.worldObj.getTotalWorldTime() > airPotionHit.get(target) + 20) {
                iter.remove();
View Full Code Here

                if (target.worldObj.getTotalWorldTime() % 5 == 0) {
                    Random rand = new Random();
                    target.setFire(6);

                    for (int i = 0; i < 30; i++) {
                        double theta = rand.nextFloat() * 2 * Math.PI;

                        double phi = rand.nextFloat() * 2 * Math.PI;
                        double r = 2.5;

                        double x = r * Math.sin(theta) * Math.cos(phi);
 
View Full Code Here

                    target.setFire(6);

                    for (int i = 0; i < 30; i++) {
                        double theta = rand.nextFloat() * 2 * Math.PI;

                        double phi = rand.nextFloat() * 2 * Math.PI;
                        double r = 2.5;

                        double x = r * Math.sin(theta) * Math.cos(phi);

                        double y = r * Math.sin(theta) * Math.sin(phi);
 
View Full Code Here

        Point[] points = new Point[3000000];
        Random random = new Random();
        for (int i = 0; i < points.length; i++) {
            // I altered the zFar variable to adapt to the points.length.
            // Points, no matter how much, now appear evenly distributed along the screen
            points[i] = new Point((random.nextFloat() - 0.5f) * 100f, (random.nextFloat() - 0.5f) * 100f,
                    random.nextInt(points.length / 50) - points.length / 50);
        }

        /**
         * Display lists
View Full Code Here

        Point[] points = new Point[3000000];
        Random random = new Random();
        for (int i = 0; i < points.length; i++) {
            // I altered the zFar variable to adapt to the points.length.
            // Points, no matter how much, now appear evenly distributed along the screen
            points[i] = new Point((random.nextFloat() - 0.5f) * 100f, (random.nextFloat() - 0.5f) * 100f,
                    random.nextInt(points.length / 50) - points.length / 50);
        }

        /**
         * Display lists
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.