Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Random;

public class Main {
    /**
     * @author TheMrMilchmann
     * @since DerpieLang v1.0.0
     */
    public static final <T> T[] fillRandomly(T[] from, T[] into) {
        return fillRandomly(from, into, System.currentTimeMillis());
    }

    /**
     * @author TheMrMilchmann
     * @since DerpieLang v1.0.0
     */
    public static final <T> T[] fillRandomly(T[] from, T[] into, long seed) {
        Random random = new Random(seed);

        for (int i = 0; i < into.length; i++) {
            into[i] = from[random.nextInt(from.length)];
        }

        return into;
    }
}