集册 Java实例教程 随机填充数组

随机填充数组

欢马劈雪     最近更新时间:2020-01-02 10:19:05

519
随机填充数组


//package com.nowjava;
/*来 自 n o w j a v a . c o m - 时代Java*/

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++) {
展开阅读全文