Examples of nextFloat()


Examples of java.util.Random.nextFloat()

        dsend = new double[length];
        drecv = new double[length];

        for (int i = 0; i < length; ++i) {
            dsend[i] = r.nextDouble();
            fsend[i] = r.nextFloat();
            lsend[i] = r.nextLong();
            isend[i] = r.nextInt();
            ssend[i] = (short) r.nextInt();
            csend[i] = (char) r.nextInt();
            bsend[i] = (byte) r.nextInt();
View Full Code Here

Examples of java.util.Random.nextFloat()

    private float[] floatArray(int count)
    {
        Random r = new Random(count);
        float[] result = new float[count];
        for (int i = 0; i < count; ++i) {
            float f = r.nextFloat();
            result[i] = r.nextBoolean() ? -f : f;
        }
        return result;
    }
View Full Code Here

Examples of java.util.Random.nextFloat()

                Random rnd = new Random(9);
                int len = ARRAY_TEST_LENGTHS[i-1];
                data = new float[len];
                for (int ix = 0; ix < len; ++ix) {
                    // Need to scale: nextFloat is [0.0, 1.0[
                    float value = rnd.nextFloat();
                    if (rnd.nextBoolean()) {
                        value = (float) (value * rnd.nextInt());
                    }
                    if (rnd.nextBoolean()) {
                        value = -value;
View Full Code Here

Examples of java.util.Random.nextFloat()

  */
  private static String generateRandomString() {
    final StringBuffer res = new StringBuffer();
    final Random rnd = new SecureRandom();
    for (int i = 0; i < 32; i++) {
      int pos = (int) (rnd.nextFloat() * CHARS.length());
      res.append(CHARS.charAt(pos));
    }
 
    return res.toString();
  }
View Full Code Here

Examples of java.util.Random.nextFloat()

    public static List<Color> getSequenceColors(int num) {
        List<Color> colors = new LinkedList<Color>();

        //On choisit H et S au random
        Random random = new Random();
        float B = random.nextFloat() * 2 / 5f + 0.6f;    //    0.6 <=   B   < 1
        float S = random.nextFloat() * 2 / 5f + 0.6f;    //    0.6 <=   S   < 1
        //System.out.println("B : "+B+"  S : "+S);

        for (int i = 1; i <= num; i++) {
            float H = i / (float) num;
View Full Code Here

Examples of java.util.Random.nextFloat()

        List<Color> colors = new LinkedList<Color>();

        //On choisit H et S au random
        Random random = new Random();
        float B = random.nextFloat() * 2 / 5f + 0.6f;    //    0.6 <=   B   < 1
        float S = random.nextFloat() * 2 / 5f + 0.6f;    //    0.6 <=   S   < 1
        //System.out.println("B : "+B+"  S : "+S);

        for (int i = 1; i <= num; i++) {
            float H = i / (float) num;
            //System.out.println(H);
View Full Code Here

Examples of java.util.Random.nextFloat()

    public static List<Color> getSequenceColors(int num) {
        List<Color> colors = new LinkedList<Color>();

        //On choisit H et S au random
        Random random = new Random();
        float B = random.nextFloat() * 2 / 5f + 0.6f;    //    0.6 <=   B   < 1
        float S = random.nextFloat() * 2 / 5f + 0.6f;    //    0.6 <=   S   < 1
        //System.out.println("B : "+B+"  S : "+S);

        for (int i = 1; i <= num; i++) {
            float H = i / (float) num;
View Full Code Here

Examples of java.util.Random.nextFloat()

        List<Color> colors = new LinkedList<Color>();

        //On choisit H et S au random
        Random random = new Random();
        float B = random.nextFloat() * 2 / 5f + 0.6f;    //    0.6 <=   B   < 1
        float S = random.nextFloat() * 2 / 5f + 0.6f;    //    0.6 <=   S   < 1
        //System.out.println("B : "+B+"  S : "+S);

        for (int i = 1; i <= num; i++) {
            float H = i / (float) num;
            //System.out.println(H);
View Full Code Here

Examples of java.util.Random.nextFloat()

      byte[] family;
      byte[] qualifier;
      byte[] value;

      // generate it or repeat, it should compress well
      if (0 < i && randomizer.nextFloat() < CHANCE_TO_REPEAT) {
        row = keyValues.get(randomizer.nextInt(keyValues.size())).getRow();
      } else {
        row = new byte[FIELD_LENGTH];
        randomizer.nextBytes(row);
      }
View Full Code Here

Examples of java.util.Random.nextFloat()

        family = new byte[FIELD_LENGTH];
        randomizer.nextBytes(family);
      } else {
        family = keyValues.get(0).getFamily();
      }
      if (0 < i && randomizer.nextFloat() < CHANCE_TO_REPEAT) {
        qualifier = keyValues.get(
            randomizer.nextInt(keyValues.size())).getQualifier();
      } else {
        qualifier = new byte[FIELD_LENGTH];
        randomizer.nextBytes(qualifier);
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.