Java Random randRange(float from, float to)

Here you can find the source of randRange(float from, float to)

Description

rand Range

License

Apache License

Declaration

public static float randRange(float from, float to) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static float randRange(float from, float to) {
        return ((float) Math.random() * (to - from)) + from;
    }/*w w  w  . j  a  va2s  .  c o  m*/

    public static int randRange(int from, int to) {
        return (int) (Math.random() * (to - from)) + from;
    }
}

Related

  1. randomUniformUniqueIntegerList(int sz)
  2. randomValue()
  3. randomValue(T[] array)
  4. randomVector(int size)
  5. randRandom(Random random)
  6. randRangeDecimal(float min, float max)
  7. resetRandomGenerator()
  8. runProbability(Random rng, float[] probs, D[] choices)