Java Random getRandomFloatArray()

Here you can find the source of getRandomFloatArray()

Description

get Random Float Array

License

Open Source License

Return

float[]

Declaration

private static float[] getRandomFloatArray() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Manchester Centre for Integrative Systems Biology
 * University of Manchester/*  w  w  w  . j  av a 2  s .co  m*/
 * Manchester M1 7ND
 * United Kingdom
 * 
 * Copyright (C) 2007 University of Manchester
 * 
 * This program is released under the Academic Free License ("AFL") v3.0.
 * (http://www.opensource.org/licenses/academic.php)
 *******************************************************************************/

import java.util.*;

public class Main {
    /**
     * 
     * @return float[]
     */
    private static float[] getRandomFloatArray() {
        final int MAX_LENGTH = 1037;
        final Random random = new Random();

        final float[] randomArray = new float[random.nextInt(MAX_LENGTH)];

        for (int i = 0; i < randomArray.length; i++) {
            randomArray[i] = random.nextFloat();
        }

        return randomArray;
    }
}

Related

  1. getRandom(int min, int max)
  2. getRandomDigits(Random r, int l, int radix)
  3. getRandomElement(T[] items)
  4. getRandomFileName()
  5. getRandomFloat()
  6. getRandomObject()
  7. getRandomPort(int low, int high)
  8. getRandomRequestId(Integer serviceId)
  9. getRandomServices(int maxSize)