Generate a random array with the specified shape and order
@param shape  Shape of the array
@param order  Order of array ('c' or 'f')
@param values Values to fill the array with
@return Random array of specified shape + contents
964574
public static INDArray generate(long[] shape, char order, Values values){
        switch (values){
            case RANDOM_UNIFORM:
                return Nd4j.rand(Nd4j.createUninitialized(shape,order));
            case RANDOM_NORMAL:
                return Nd4j.randn(Nd4j.createUninitialized(shape,order));
            case ONE_HOT:
                Random r = new Random(Nd4j.getRandom().nextLong());
                INDArray out = Nd4j.create(shape,order);
                if(shape.length == 1){
                    out.putScalar(r.nextInt((int) shape[0]), 1.0);
                } else if(shape.length == 2){
                    for( int i=0; i<shape[0]; i++ ){
                        out.putScalar(i, r.nextInt((int) shape[1]), 1.0);
                    }
                } else if(shape.length == 3){
                    for( int i=0; i<shape[0]; i++ ){
                        for(int j=0; j<shape[2]; j++ ){
                            out.putScalar(i, r.nextInt((int) shape[1]), j, 1.0);
                        }
                    }
                } else if(shape.length == 4){
                    for( int i=0; i<shape[0]; i++ ){
                        for(int j=0; j<shape[2]; j++ ){
                            for(int k=0; k<shape[3]; k++ ) {
                                out.putScalar(i, r.nextInt((int) shape[1]), j, k, 1.0);
                            }
                        }
                    }
                } else if(shape.length == 5){
                    for( int i=0; i<shape[0]; i++ ){
                        for(int j=0; j<shape[2]; j++ ){
                            for(int k=0; k<shape[3]; k++ ) {
                                for( int l=0; l<shape[4]; l++ ) {
                                    out.putScalar(new int[]{i, r.nextInt((int) shape[1]), j, k, l}, 1.0);
                                }
                            }
                        }
                    }
                } else {
                    throw new RuntimeException("Not supported: rank 6+ arrays. Shape: " + Arrays.toString(shape));
                }
                return out;
            case ZEROS:
                return Nd4j.create(shape,order);
            case ONES:
                return Nd4j.createUninitialized(shape,order).assign(1.0);
            case BINARY:
                return Nd4j.getExecutioner().exec(new BernoulliDistribution(Nd4j.createUninitialized(shape, order), 0.5));
            case INTEGER_0_10:
                return Transforms.floor(Nd4j.rand(shape).muli(10), false);
            case INTEGER_0_100:
                return Transforms.floor(Nd4j.rand(shape).muli(100), false);
            case INTEGER_0_1000:
                return Transforms.floor(Nd4j.rand(shape).muli(1000), false);
            case INTEGER_0_10000:
                return Transforms.floor(Nd4j.rand(shape).muli(10000), false);
            case INTEGER_0_100000:
                return Transforms.floor(Nd4j.rand(shape).muli(100000), false);
            default:
                throw new RuntimeException("Unknown enum value: " + values);

        }
    }
825957
@Override
  public LaxImmutableMapBuilder<K, V> orderEntriesByValue(Comparator<? super V> valueComparator) {
    this.immutableMapEntryOrdering = checkNotNull(valueComparator);
    return this;
  }
1229851
public static String pick(String[] values) {
		if (values == null || values.length == 0)
			return "";

		int index = RandomInteger.nextInteger(values.length);
		return values[index];
	}
504033
@Override
    public INDArray rand(int[] shape, float min, float max, org.nd4j.linalg.api.rng.Random rng) {
        //ensure shapes that wind up being scalar end up with the write shape
        if (shape.length == 1 && shape[0] == 0) {
            shape = new int[] {1, 1};
        }
        return Nd4j.getDistributions().createUniform(min, max).sample(shape);
    }
8361
public static INDArrayIndex[] indexesFor(long... shape) {
        INDArrayIndex[] ret = new INDArrayIndex[shape.length];
        for (int i = 0; i < shape.length; i++) {
            ret[i] = NDArrayIndex.point(shape[i]);
        }

        return ret;
    }
270735
public static Value.Builder makeValue(Iterable<Value> values) {
    return Value.newBuilder().setArrayValue(ArrayValue.newBuilder().addAllValues(values));
  }
726500
public SDVariable randomExponential(double lambda, SDVariable shape) {
        return new RandomExponential(sameDiff(), shape, lambda).outputVariable();
    }
723691
@Override
    public INDArray valueArrayOf(long rows, long columns, double value) {
        INDArray create = createUninitialized(new long[] {rows, columns}, Nd4j.order());
        create.assign(value);
        return create;
    }
1044964
protected static DataBuffer createValueBuffer(float[] values) {
        checkNotNull(values);
        if (values.length == 0){
            return Nd4j.createBuffer(1);
        }
        return Nd4j.createBuffer(values);
    }
1162091
public static JsonArray array(int... values) {
    if (values == null) {
      throw new NullPointerException(VALUES_IS_NULL);
    }
    JsonArray array = new JsonArray();
    for (int value : values) {
      array.add(value);
    }
    return array;
  }
776712
public static <E> List<E> newArrayList(E... values) {
    List<E> list = new ArrayList<E>(values.length);
    for (E e : values) {
      list.add(e);
    }
    return list;
  }
86874
public static <K, V> Ordering<Map.Entry<K, V>> byValueOrdering(final Ordering<V> valueOrdering) {
    return valueOrdering.onResultOf(MapUtils.<K, V>getEntryValue());
  }
1014336
@Deprecated
    public static void setOrder(IntBuffer buffer, char order) {
        int length = Shape.shapeInfoLength(Shape.rank(buffer));
        buffer.put(length - 1, (int) order);
        throw new RuntimeException("setOrder called");
    }
145913
public ListOrdersRequest withOrderStatus(String... values) {
        List<String> list = getOrderStatus();
        for (String value : values) {
            list.add(value);
        }
        return this;
    }
594882
def random(self, shape, tf_fn, kwargs):
    
    slice_shape = self.slice_shape(shape)
    op_seed = random.random()
    def my_fn(pnum):
      # seeds are necessary to make sure that slices that should have the
      # same values actually do have the same values.
      seed = hash("%s,%s" % (op_seed, self.slice_begin(shape, pnum)))
      return tf_fn(slice_shape, seed=seed, **kwargs)
    return self.slicewise(my_fn, self.laid_out_pnum())
54107
public static String formatCompiledPattern(String compiledPattern, CharSequence... values) {
        return formatAndAppend(compiledPattern, new StringBuilder(), null, values).toString();
    }
1076108
@Override
    public void _randomOrdering(String seed) {
        assertNoRawQuery();

        if (StringUtils.isBlank(seed)) {
            _randomOrdering();
            return;
        }

        _noCaching();
        orderByTokens.add(OrderByToken.createRandom(seed));
    }