Esempio n. 1
0
    public void GenWellRandom()
    {
        Vector3 pos = new Vector3
        {
            x = GetValue(Well512.Next(0, (int)range.x), range.x),
            y = GetValue(Well512.Next(0, (int)range.y), range.y),
            z = GetValue(Well512.Next(0, (int)range.z), range.z)
        };

        CreatePrefab(pos);
    }
Esempio n. 2
0
    private IEnumerator StartBench()
    {
        yield return(new WaitForEndOfFrame());

        StartTest(() =>
        {
            var n = Random.Range(0.0f, 1.0f);
        }, "Unity Random", bench);
        yield return(new WaitForEndOfFrame());

        StartTest(() =>
        {
            var n = sys.NextDouble();
        }, "System Random", bench);
        yield return(new WaitForEndOfFrame());

        StartTest(() =>
        {
            var n = mt.genrand64_real1();
        }, "Mt Random 1", bench);
        yield return(new WaitForEndOfFrame());

        StartTest(() =>
        {
            var n = mt.genrand64_real2();
        }, "Mt Random 2", bench);
        yield return(new WaitForEndOfFrame());

        StartTest(() =>
        {
            var n = mt.genrand64_real3();
        }, "Mt Random 3", bench);
        yield return(new WaitForEndOfFrame());

        StartTest(() =>
        {
            var n = Well512.Next();
        }, "Well Random", bench);
        yield return(new WaitForEndOfFrame());

        StartTest(() =>
        {
            var n = pcg.NextDouble();
        }, "PCG Random", bench);
        yield return(new WaitForEndOfFrame());
    }
Esempio n. 3
0
    void Awake()
    {
        prefab = Resources.Load <GameObject>("Dot");

        tr       = gameObject.transform;
        collider = GetComponent <BoxCollider>();

        range = collider.size;

        sw = new Stopwatch();

        sys = new System.Random();
        mt  = new mt19937_64();
        //well = new Well512();
        pcg = new Pcg();

        Well512.Next();
    }
Esempio n. 4
0
    public Magician()
    {
        Well512 random = new Well512();

        uint[] prob = { 30, 35, 25, 10, 5 };

        charInfo.type         = (byte)CharacterType.kMagician;
        charInfo.grade        = (byte)(random.Next(prob) + 1);
        charInfo.strength     = (ushort)random.Next(1, 3);
        charInfo.stamina      = (ushort)random.Next(1, 5);
        charInfo.intelligence = (ushort)random.Next(3, 12);
        charInfo.agility      = (ushort)random.Next(1, 5);
        charInfo.lucky        = (ushort)random.Next(1, 5);
    }
Esempio n. 5
0
    public Archer()
    {
        Well512 random = new Well512();

        uint[] prob = { 30, 35, 25, 10, 5 };

        charInfo.type         = (byte)CharacterType.kArcher;
        charInfo.grade        = (byte)(random.Next(prob) + 1);
        charInfo.strength     = (ushort)random.Next(3, 6);
        charInfo.stamina      = (ushort)random.Next(1, 5);
        charInfo.intelligence = (ushort)random.Next(2, 6);
        charInfo.agility      = (ushort)random.Next(4, 10);
        charInfo.lucky        = (ushort)random.Next(1, 7);
    }