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); }
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()); }
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(); }
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); }
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); }