Package java.util

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


  */
  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

    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

        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

    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

        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

      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

        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

            randomizer.nextInt(keyValues.size())).getQualifier();
      } else {
        qualifier = new byte[FIELD_LENGTH];
        randomizer.nextBytes(qualifier);
      }
      if (0 < i && randomizer.nextFloat() < CHANCE_TO_REPEAT) {
        value = keyValues.get(randomizer.nextInt(keyValues.size())).getValue();
      } else {
        value = new byte[FIELD_LENGTH];
        randomizer.nextBytes(value);
      }
View Full Code Here

        value = keyValues.get(randomizer.nextInt(keyValues.size())).getValue();
      } else {
        value = new byte[FIELD_LENGTH];
        randomizer.nextBytes(value);
      }
      if (0 < i && randomizer.nextFloat() < CHANCE_TO_REPEAT) {
        timestamp = keyValues.get(
            randomizer.nextInt(keyValues.size())).getTimestamp();
      } else {
        timestamp = randomizer.nextLong();
      }
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.