Java Random Int randomPointsFromUnitSquare(int n)

Here you can find the source of randomPointsFromUnitSquare(int n)

Description

random Points From Unit Square

License

Open Source License

Declaration

public static double[][] randomPointsFromUnitSquare(int n) 

Method Source Code

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

public class Main {
    public static double[][] randomPointsFromUnitSquare(int n) {
        if (n <= 0) {
            throw new IllegalArgumentException();
        }/* ww  w  .j  ava2  s  .c  o m*/

        double[][] result = new double[n][2];

        for (int i = 0; i < n; i++) {
            result[i][0] = Math.random();
            result[i][1] = Math.random();
        }

        return result;
    }
}

Related

  1. randomNumberWithinRange(int min, int max)
  2. randomPass(int n)
  3. randomPointInConvexPoly(float[] pts, int npts, float[] areas, float s, float t)
  4. randomPointsFromFigureEight(int n)
  5. randomPointsFromUnitSphere(int n)
  6. randomQuickSort(int[] array)
  7. randomRange(int min, int max)
  8. randomSize(int maxValue)
  9. randomSMSCode(int length)