Java ThreadLocalRandom moveInRadius(double[] position, double radius)

Here you can find the source of moveInRadius(double[] position, double radius)

Description

move In Radius

License

Open Source License

Declaration

public static double[] moveInRadius(double[] position, double radius) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.concurrent.ThreadLocalRandom;

public class Main {
    public static double[] moveInRadius(double[] position, double radius) {
        double[] newPosition = new double[position.length];

        for (int i = 0; i < position.length; i++) {
            newPosition[i] = position[i] + ThreadLocalRandom.current().nextDouble(-radius, radius);
        }//from   w  w  w.  j  a  v  a  2  s  .  c om

        return newPosition;
    }
}

Related

  1. getRandomTarget(List targets)
  2. getRandomValue(String prefix, long maxValue)
  3. getTempPersistFileName(String baseFileName)
  4. getThreadLocalRandom()
  5. isRandomOccurrence(int pcLikelihood)
  6. parseSeed(String seedString)
  7. rand(final Collection items)
  8. randInt(int min, int max)
  9. random()