Beispiel #1
0
    private static float[] GenerateRandomArray(int count, GenerateRandomFunc func)
    {
        float[] nums = new float[count];

        for (int i = 0; i < count; i++)
        {
            nums[i] = func();
        }

        return(nums);
    }
Beispiel #2
0
    public static float[] GenerateRandomArray01(int count, Type type)
    {
        GenerateRandomFunc func = null;

        switch (type)
        {
        case Type.Unity:
            func = () => UnityEngine.Random.Range(0f, 1.0f);
            break;

        case Type.DotNet:
            func = GetRandomDotnetFloat;
            break;

        default:
            throw new System.Exception("undefined type = " + type);
        }

        return(GenerateRandomArray(count, func));
    }