Ejemplo n.º 1
0
    private void SampleRandom()
    {
        Debug.Log("GENERATING RANDOM " + _randomType + " WITH SEED: " + seed);

        UnityRandom urand = new UnityRandom(seed);

        if (randomList == null)
        {
            randomList = new ArrayList();
        }
        randomList.Clear();

        switch (_randomType)
        {
        case RandomType.NUMBER: SampleNumber(ref urand); break;

        case RandomType.VECTOR_2D: SampleVector2D(ref urand); break;

        case RandomType.VECTOR_3D: SampleVector3D(ref urand); break;

        case RandomType.COLOR: SampleColor(ref urand); break;

        case RandomType.DICE: SampleDice(ref urand); break;

        case RandomType.SHUFFLEBAG: SampleShuffle(ref urand); break;

        case RandomType.WEIGHTEDBAG: SampleWShuffle(ref urand); break;

        default: SampleNumber(ref urand); break;
        }

        this.Repaint();
    }
Ejemplo n.º 2
0
 private void SampleDice(ref UnityRandom _urand)
 {
     for (int i = 0; i < samplig_size; i++)
     {
         randomList.Add(_urand.RollDice(nroll, dice));
     }
 }
Ejemplo n.º 3
0
    //////////////////////////////////////////////////////////////////////////
    public void Pretend()
    {
        // preform grid pretends
        for (var r = Grid.Instance.m_Column - 1; r >= 0; r--)
        {
            foreach (var slot in Grid.Instance.GetRow(r, true))
            {
                slot.m_Actor?.Pretend();
            }
        }
        // randomize reserve order
        UnityRandom.RandomizeList(m_ReserveActors);
        // preform reserve pretends
        foreach (var actor in m_ReserveActors.ToList())
        {
            actor.Pretend();
        }

        // implement moves
        foreach (var actor in m_ReserveActors)
        {
            actor.ImplementMove();
        }
        foreach (var actor in m_BoardActors)
        {
            actor.ImplementMove();
        }
    }
Ejemplo n.º 4
0
    public string GetNextRandomName(ICollection <NameElement> tokens)
    {
        if (tokens == null)
        {
            return(GetNextRandomName());
        }

        var result = "";

        var rule = UnityRandom.RandomFromList(m_RulesList.List);

        foreach (var token in rule)
        {
            if (UnityRandom.Bool(token.Value))
            {
                var tokenChoise = m_SyllableDictionary[token.Key];
                var syllable    = tokenChoise.GetSyllable();
                result += syllable;

                tokens.Add(new NameElement()
                {
                    m_Tag = token.Key, m_Syllable = syllable
                });
            }
        }

        return(result);
    }
Ejemplo n.º 5
0
    public Vector3 KillMostWeakCharacter()
    {
        int minHp      = int.MaxValue;
        var candidates = new List <Character>();

        foreach (var n in Tribe.Instance.m_CharacterList)
        {
            if (n.m_Health < minHp)
            {
                minHp = n.m_Health;
                candidates.Clear();
                candidates.Add(n);
            }
            else
            if (n.m_Health == minHp)
            {
                candidates.Add(n);
            }
        }

        var deadMan = UnityRandom.RandomFromList(Tribe.Instance.m_CharacterList, null);

        if (deadMan != null)
        {
            deadMan.Dead();
            return(deadMan.transform.position);
        }

        return(Vector3.zero);
    }
Ejemplo n.º 6
0
    public void Dead()
    {
        if (m_State == CharacterState.Dead)
        {
            return;
        }

        SoundManager.Instance.Play("Dead");

        Destroy(GetComponent <Collider2D>());
        transform.rotation = Quaternion.Euler(0.0f, 0.0f, (UnityRandom.Bool() ? 1: -1) * UnityEngine.Random.Range(45.0f, 135.0f));

        if (implIsNative())
        {
            m_CurrentHub.DefenderIsDead(this);
        }
        else
        {
            Tribe.Instance.CharacterIsDead(this);
        }

        if (m_State == CharacterState.Travel)
        {
            SwarmManager.Instance.Initialize();
        }

        m_Animator.enabled = false;

        m_State = CharacterState.Dead;
    }
    //////////////////////////////////////////////////////////////////////////
    public Sprite Roll()
    {
        if (m_WeightedBag == null)
        {
            m_WeightedBag = UnityRandom.CreateWeightedBag(m_Data.Select(n => n.m_Sprite), m_Data.Select(n => n.m_Chanse));
        }

        return(m_WeightedBag.Next());
    }
Ejemplo n.º 8
0
 public void ImplementMove()
 {
     if (m_Slot != null)
     {
         m_MoveTween.Cancel();
         m_MoveTween.MovePosition = m_Slot.transform.position + UnityRandom.Vector2(PlayerEntity.Instance.m_PositionRandomization).To3DXY();
         m_MoveTween.Start();
     }
 }
Ejemplo n.º 9
0
    public void RemoveArmor()
    {
        var slot = UnityRandom.RandomFromList(m_ArmorList.Where((s) => !s.m_EmptySlot).ToList(), null);

        if (slot != null)
        {
            slot.TakeOff();
        }
    }
Ejemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        UnityRandom urand = new UnityRandom();
        float       val   = urand.Possion(035.6f);
        float       val2  = urand.Possion(3.0f);

        Debug.Log(val);
        Debug.Log(val2);
    }
Ejemplo n.º 11
0
    public void KillRandomCharacter()
    {
        var deadMan = UnityRandom.RandomFromList(Tribe.Instance.m_CharacterList, null);

        if (deadMan != null)
        {
            deadMan.Dead();
        }
    }
Ejemplo n.º 12
0
    private void implDead()
    {
        m_Animate.enabled   = false;
        m_Rotate.enabled    = false;
        m_Translate.enabled = false;

        Destroy(GetComponent <Collider2D>());
        transform.rotation = Quaternion.Euler(0.0f, 0.0f, (UnityRandom.Bool() ? 1 : -1) * UnityEngine.Random.Range(45.0f, 135.0f));
    }
Ejemplo n.º 13
0
    private void SampleShuffle(ref UnityRandom _urand)
    {
        ShuffleBagCollection <float> thebag = _urand.ShuffleBag(shufflebag);

        for (int m = 0; m < samplig_size; m++)
        {
            randomList.Add(thebag.Next());
        }
        randomList.Sort();
    }
Ejemplo n.º 14
0
    //////////////////////////////////////////////////////////////////////////
    public GameObject Roll(float scale)
    {
        if (m_WeightedBag == null)
        {
            m_WeightedBag = UnityRandom.CreateWeightedBag(m_Data.Select(n => n.m_Prefab), m_Data.Select(n => n.m_Chanse.Evaluate(scale)));
        }

        var result = m_WeightedBag.Next();

        return(result);
    }
 //////////////////////////////////////////////////////////////////////////
 public override void iProceedTurn()
 {
     if (UnityRandom.Bool(m_PhotoChanse))
     {
         PlayerEntity.Instance.m_ActionSequence.Add(new Actor.ActionPhoto()
         {
             m_Delay = Random.Range(m_PhotoDelay.x, m_PhotoDelay.y),
             Master  = Master
         });
     }
 }
Ejemplo n.º 16
0
    public void AddArmor()
    {
        var slot = UnityRandom.RandomFromList(m_ArmorList.Where((s) => s.m_EmptySlot).ToList(), null);

        if (slot != null)
        {
            slot.Wear();
        }

        PlayerManager.Instance.AddArmor(transform.position);
        m_Health++;
    }
Ejemplo n.º 17
0
    void Start()
    {
        waitingTimes.Add("Farmacia", 0);
        waitingTimes.Add("Salchichas", 0);
        waitingTimes.Add("Atencion_Cliente", 0);
        waitingTimes.Add("Carnes", 0);
        waitingTimes.Add("Compras", 0);
        waitingTimes.Add("Caja", 0);
        waitingTimes.Add("Embolsadora", 0);

        numberOfTransitions = 0;
        done             = false;
        numberOfItems    = 0;
        nextTargetString = "";
        nextTarget       = null;
        manager          = VariableManager.instance;
        id          = manager.asignNewId();
        urand       = new UnityRandom();
        waitingTime = 0;
        float Farmacia        = urand.Value();
        float Salchichas      = urand.Value();
        float AtencionCliente = urand.Value();
        float Carnes          = urand.Value();
        float Compra          = urand.Value();

        if (Farmacia <= manager.ProbabilidadFarmacia)
        {
            FarmaciaBool = true;
            places.Add("Farmacia");
        }
        if (Salchichas <= manager.ProbabilidadSalchichoneria)
        {
            SalchichasBool = true;
            places.Add("Salchichas");
        }
        if (AtencionCliente <= manager.ProbabilidadServicioCliente)
        {
            AtencionClienteBool = true;
            places.Add("Atencion_Cliente");
        }
        if (Carnes <= manager.ProbabilidadCarnes)
        {
            CarnesBool = true;
            places.Add("Carnes");
        }
        if (Compra <= manager.ProbabilidadCompras)
        {
            CompraBool    = true;
            numberOfItems = manager.getNormalDistribution("Compra");
        }
        transform.GetChild(0).GetComponent <Text>().text = id.ToString();
        makeDecision();
    }
Ejemplo n.º 18
0
        public T GetData(UnityRandom rand)
        {
            UpdatePriority();
            var urand = RandomUtil.Urand;

            RandomUtil.SetUnityRandom(rand);
            int index = RandomUtil.GetUnityRandomIndexWithWeight(priorityArray);

            RandomUtil.SetUnityRandom(urand);

            return(elements[index].Data);
        }
Ejemplo n.º 19
0
 void OnLevelWasLoaded()
 {
     if (SceneManager.GetActiveScene().name == "Grid")
     {
         manager      = GameObject.Find("Compras").GetComponent <AreaManager>();
         cleaningText = GameObject.Find("Compras").transform.GetChild(3).GetComponent <Text>();
         cleaningText.gameObject.SetActive(false);
         endSeconds   = 0;
         startSeconds = VariableManager.instance.secondsElapsed;
         urand        = new UnityRandom();
         cleaning     = false;
     }
 }
Ejemplo n.º 20
0
    public void Detained()
    {
        var bodyguard = PlayerEntity.Instance.GetBodyguard();

        if (bodyguard == null)
        {
            SoundManager.Instance.PlaySound("Ban");
            return;
        }

        if (m_Slot != null)
        {
            m_Slot.m_Actor = null;
            m_Slot         = null;
        }

        // play sound
        SoundManager.Instance.PlaySound("Detain");

        // disable colliders
        foreach (var collider in GetComponentsInChildren <Collider2D>())
        {
            collider.enabled = false;
        }

        PlayerEntity.Instance.m_BoardActors.Remove(this);
        PlayerEntity.Instance.m_ReserveActors.Remove(this);

        var closestDetainedBounds =
            Vector3.Distance(PlayerEntity.Instance.m_ZoneDetaindLeft.ClosestPoint(transform.position), transform.position)
            < Vector3.Distance(PlayerEntity.Instance.m_ZoneDetaindRight.ClosestPoint(transform.position), transform.position)
                ? PlayerEntity.Instance.m_ZoneDetaindLeft
                : PlayerEntity.Instance.m_ZoneDetaindRight;

        // play move animation
        m_DetainedTween.MovePosition = UnityRandom.BoundPoint(closestDetainedBounds);
        m_DetainedTween
        .Start()
        .setDelay(bodyguard.Detain(this, out var model))
        .setOnStart(() =>
        {
            // link model
            model.transform.SetParent(transform, false);
            model.transform.localPosition = UnityRandom.Vector2(PlayerEntity.Instance.m_PositionRandomization).WithY(-0.1f);
        })
        .setOnComplete(() =>
        {
            Destroy(model);
            Destroy(gameObject);
        });
    }
Ejemplo n.º 21
0
    public List <Slot> GetTransitions(Direction requireFlags, bool randomize)
    {
        var result = m_TransitionDictionary
                     .Where(n => n.Key.HasFlag(requireFlags))
                     .Select(n => n.Value)
                     .ToList();

        if (randomize)
        {
            UnityRandom.RandomizeList(result);
        }

        return(result);
    }
Ejemplo n.º 22
0
 private void SampleColor(ref UnityRandom _urand)
 {
     for (int i = 0; i < samplig_size; i++)
     {
         if (transform)
         {
             randomList.Add(_urand.Rainbow(normalization, temperature));
         }
         else
         {
             randomList.Add(_urand.Rainbow());
         }
     }
 }
Ejemplo n.º 23
0
    private void SampleVector3D(ref UnityRandom _urand)
    {
        for (int i = 0; i < samplig_size; i++)
        {
            switch (_randomVector3DType)
            {
            case RandomVector3DType.INCUBE:
                if (transform)
                {
                    randomList.Add(_urand.PointInACube(normalization, temperature));
                }
                else
                {
                    randomList.Add(_urand.PointInACube());
                }
                break;

            case RandomVector3DType.ONCUBE:
                if (transform)
                {
                    randomList.Add(_urand.PointOnACube(normalization, temperature));
                }
                else
                {
                    randomList.Add(_urand.PointOnACube());
                }
                break;

            case RandomVector3DType.INSPHERE:
                randomList.Add(_urand.PointInASphere());
                break;

            case RandomVector3DType.ONSPHERE:
                randomList.Add(_urand.PointOnASphere());
                break;

            case RandomVector3DType.ONCAP:
                randomList.Add(_urand.PointOnCap(spotAngle));
                break;

            case RandomVector3DType.ONRING:
                randomList.Add(_urand.PointOnRing(innerAngle, outerAngle));
                break;

            default:
                break;
            }
        }
    }
Ejemplo n.º 24
0
    public int getNormalDistribution(string Area)
    {
        UnityRandom urand = new UnityRandom();

        switch (Area)
        {
        case "Compra":
        {
            return((int)urand.Range(1, _numberOfItems, UnityRandom.Normalization.STDNORMAL, 1.0f));

            break;
        }
        }
        return(0);
    }
Ejemplo n.º 25
0
    public void Apply(float force)
    {
        switch (m_Method)
        {
        case Method.Random:
            GetComponent <Rigidbody2D>().AddForce(UnityRandom.Normal2D() * force, m_Mode);
            break;

        case Method.Vector:
            Apply(m_Vector * force, m_Force);
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
    }
Ejemplo n.º 26
0
    private void SampleNumber(ref UnityRandom _urand)
    {
        for (int i = 0; i < samplig_size; i++)
        {
            switch (_randomNumberType)
            {
            case RandomNumberType.VALUE:
                if (transform)
                {
                    randomList.Add(_urand.Value(normalization, temperature));
                }
                else
                {
                    randomList.Add(_urand.Value());
                }
                break;

            case RandomNumberType.RANGE:
                if (transform)
                {
                    randomList.Add(_urand.Range(_range_min, _range_max, normalization, temperature));
                }
                else
                {
                    randomList.Add(_urand.Range(_range_min, _range_max));
                }
                break;


            case RandomNumberType.POISSON:
                randomList.Add(_urand.Possion(temperature));
                break;

            case RandomNumberType.EXPONENTIAL:
                randomList.Add(_urand.Exponential(temperature));
                break;

            case RandomNumberType.GAMMA:
                randomList.Add(_urand.Gamma(temperature));
                break;

            default:
                break;
            }
        }
        randomList.Sort();
    }
Ejemplo n.º 27
0
    public List <Slot> GetRow(int index, bool randomize)
    {
        if (index >= m_SlotList.Count)
        {
            return(null);
        }

        var result = m_SlotList[index];

        if (randomize)
        {
            result = result.ToList();
            UnityRandom.RandomizeList(result);
        }

        return(result);
    }
Ejemplo n.º 28
0
		public static Vector2 Circle( ref NPack.MersenneTwister _rand, UnityRandom.Normalization n, float t )
		{
			float r;
			switch (n) {
			case UnityRandom.Normalization.STDNORMAL:
				r = SpecialFunctions.ScaleFloatToRange( (float) NormalDistribution.Normalize(_rand.NextSingle(true), t), 0, Int32.MaxValue, 0, 1);
			break;
			case UnityRandom.Normalization.POWERLAW:
				r = (float) PowerLaw.Normalize(_rand.NextSingle(true), t, 0, Int32.MaxValue);
			break;
			default:
				r = (float) _rand.Next();
			break;
			}			
			float _2pi = (float) Math.PI * 2;
			float a = SpecialFunctions.ScaleFloatToRange(r, 0, _2pi, 0, Int32.MaxValue);
			return new Vector2( (float) Math.Cos(a) , (float) Math.Sin(a));
		}
Ejemplo n.º 29
0
    private void SampleVector2D(ref UnityRandom _urand)
    {
        for (int i = 0; i < samplig_size; i++)
        {
            switch (_randomVector2DType)
            {
            case RandomVector2DType.SQUARE:
                if (transform)
                {
                    randomList.Add(_urand.PointInASquare(normalization, temperature));
                }
                else
                {
                    randomList.Add(_urand.PointInASquare());
                }
                break;

            case RandomVector2DType.CIRCLE:
                if (transform)
                {
                    randomList.Add(_urand.PointInACircle(normalization, temperature));
                }
                else
                {
                    randomList.Add(_urand.PointInACircle());
                }
                break;

            case RandomVector2DType.DISK:
                if (transform)
                {
                    randomList.Add(_urand.PointInADisk(normalization, temperature));
                }
                else
                {
                    randomList.Add(_urand.PointInADisk());
                }
                break;

            default:
                break;
            }
        }
    }
Ejemplo n.º 30
0
    public void Leave()
    {
        if (m_Slot != null)
        {
            m_Slot.m_Actor = null;
            m_Slot         = null;
        }

        PlayerEntity.Instance.m_BoardActors.Remove(this);
        PlayerEntity.Instance.m_ReserveActors.Remove(this);

        m_LeaveTween.MovePosition = UnityRandom.BoundPoint(PlayerEntity.Instance.m_ZoneLeave);
        m_LeaveTween
        .Start()
        .setOnComplete(() =>
        {
            Destroy(gameObject);
        });
    }
Ejemplo n.º 31
0
    public string GetNextRandomName()
    {
        var result = "";

        // get random token combination
        var rule = UnityRandom.RandomFromList(m_RulesList.List);

        foreach (var token in rule)
        {
            // roll token chance
            if (UnityRandom.Bool(token.Value))
            {
                var tokenChoise = m_SyllableDictionary[token.Key];
                result += tokenChoise.GetSyllable();
            }
        }

        return(result);
    }
Ejemplo n.º 32
0
		public static Vector2 Disk( ref NPack.MersenneTwister _rand, UnityRandom.Normalization n, float temp )
		{
			double t, theta;
			
			switch (n) {
			case UnityRandom.Normalization.STDNORMAL:
				t = NormalDistribution.Normalize(_rand.NextSingle(true), temp);
				theta = NormalDistribution.Normalize(_rand.NextSingle(true), temp) * 2 * Math.PI;	
			break;
			case UnityRandom.Normalization.POWERLAW:
				t = PowerLaw.Normalize(_rand.NextSingle(true), temp, 0, 1);
				theta = PowerLaw.Normalize(_rand.NextSingle(true), temp, 0, 1) * 2 * Math.PI;	
			break;
			default:
				t = (float)  _rand.NextSingle(true);
				theta = _rand.NextSingle(false) * 2 * Math.PI;
			break;
			}
			
			return new Vector2( (float) (Math.Sqrt(t) * Math.Cos(theta)), (float) (Math.Sqrt(t) * Math.Sin(theta)) );			
		}
Ejemplo n.º 33
0
		public static Vector2 Area( ref NPack.MersenneTwister _rand, UnityRandom.Normalization n, float t )
		{
			float x,y;
			x = y = 0;
			switch (n) {
			case UnityRandom.Normalization.STDNORMAL:
				x = (float) NormalDistribution.Normalize(_rand.NextSingle(true), t);
				y = (float) NormalDistribution.Normalize(_rand.NextSingle(true), t);
			break;
			case UnityRandom.Normalization.POWERLAW:
				x = (float) PowerLaw.Normalize(_rand.NextSingle(true), t, 0, 1);
				y = (float) PowerLaw.Normalize(_rand.NextSingle(true), t, 0, 1);
			break;
			default:
				x = _rand.NextSingle(true);
				y = _rand.NextSingle(true);
			break;
			}
			
			// Move to -1, 1 space as for CIRCLE and SPHERE
			return new Vector2((2*x - 1), (2*y - 1));
		}
Ejemplo n.º 34
0
		public static Vector3 Surface(ref NPack.MersenneTwister _rand, UnityRandom.Normalization n, float t)
		{
			Vector3 pos = new Vector3();
			switch (n) {
			case UnityRandom.Normalization.STDNORMAL:
				pos = GetPointOnCubeSurface(
					(float) NormalDistribution.Normalize(_rand.NextSingle(true), t),
					(float) NormalDistribution.Normalize(_rand.NextSingle(true), t),
					_rand.Next(5));
			break;
			case UnityRandom.Normalization.POWERLAW:
				pos = GetPointOnCubeSurface(
					(float) PowerLaw.Normalize(_rand.NextSingle(true), t, 0, 1),
					(float) PowerLaw.Normalize(_rand.NextSingle(true), t, 0, 1),
					_rand.Next(5));
			break;
			default:
				pos = GetPointOnCubeSurface(_rand.NextSingle(true),_rand.NextSingle(true),_rand.Next(5));
			break;
			}
			
			// Move to -1, 1 space as for CIRCLE and SPHERE
			return new Vector3((2*pos.x)-1, (2*pos.y)-1, (2*pos.z)-1);
		}
 private void SampleShuffle(ref UnityRandom _urand)
 {
     ShuffleBagCollection<float> thebag = _urand.ShuffleBag(shufflebag);
     for (int m = 0; m < samplig_size; m++)
     {
         randomList.Add(thebag.Next());
     }
     randomList.Sort();
 }
Ejemplo n.º 36
0
 public PRNG(int seed)
 {
     urand = new UnityRandom(seed);
 }
	public static UnityRandom initialize_seed(string key, int seed = 0){
		channels[key] = new UnityRandom(seed);
		return channels[key];
	}
Ejemplo n.º 38
0
 // INIT a new UnityRandom object with a random seed
 private void InitRandom()
 {
     urand = new UnityRandom(seed);
 }
 private void SampleVector3D(ref UnityRandom _urand)
 {
     for (int i = 0; i < samplig_size; i++)
     {
         switch (_randomVector3DType) {
         case RandomVector3DType.INCUBE:
             if (transform) {
                 randomList.Add(_urand.PointInACube(normalization,temperature));
             } else {
                 randomList.Add(_urand.PointInACube());
             }
         break;
         case RandomVector3DType.ONCUBE:
             if (transform) {
                 randomList.Add(_urand.PointOnACube(normalization,temperature));
             } else {
                 randomList.Add(_urand.PointOnACube());
             }
         break;
         case RandomVector3DType.INSPHERE:
             randomList.Add(_urand.PointInASphere());
         break;
         case RandomVector3DType.ONSPHERE:
             randomList.Add(_urand.PointOnASphere());
         break;
         case RandomVector3DType.ONCAP:
             randomList.Add(_urand.PointOnCap(spotAngle));
         break;
         case RandomVector3DType.ONRING:
             randomList.Add(_urand.PointOnRing(innerAngle,outerAngle));
         break;
         default:
         break;
         }
     }
 }
    // Really no time to make it better (FIXME)
    private void SampleWShuffle(ref UnityRandom _urand)
    {
        wshufflebag = new Dictionary<float,int>();
        // fill the wshufflebag
        wshufflebag[1] = 5;
        wshufflebag[2] = 10;
        wshufflebag[3] = 10;
        wshufflebag[4] = 25;
        wshufflebag[5] = 25;
        wshufflebag[6] = 10;
        wshufflebag[7] = 5;
        wshufflebag[8] = 5;
        wshufflebag[9] = 3;
        wshufflebag[10] = 2;

        ShuffleBagCollection<float> thebag = _urand.ShuffleBag(wshufflebag);
        for (int m = 0; m < samplig_size; m++)
        {
            randomList.Add(thebag.Next());
        }
        randomList.Sort();
    }
Ejemplo n.º 41
0
 public PRNG()
 {
     var r = new System.Random();
     var seed = r.Next();
     urand = new UnityRandom(seed);
 }
 private void SampleVector2D(ref UnityRandom _urand)
 {
     for (int i = 0; i < samplig_size; i++)
     {
         switch (_randomVector2DType) {
         case RandomVector2DType.SQUARE:
             if (transform) {
                 randomList.Add(_urand.PointInASquare(normalization,temperature));
             } else {
                 randomList.Add(_urand.PointInASquare());
             }
         break;
         case RandomVector2DType.CIRCLE:
             if (transform) {
                 randomList.Add(_urand.PointInACircle(normalization,temperature));
             } else {
                 randomList.Add(_urand.PointInACircle());
             }
         break;
         case RandomVector2DType.DISK:
             if (transform) {
                 randomList.Add(_urand.PointInADisk(normalization,temperature));
             } else {
                 randomList.Add(_urand.PointInADisk());
             }
         break;
         default:
         break;
         }
     }
 }
    private void SampleRandom()
    {
        Debug.Log("GENERATING RANDOM " + _randomType + " WITH SEED: " + seed);

        UnityRandom urand = new UnityRandom(seed);
        if (randomList == null)	randomList = new ArrayList();
        randomList.Clear();

        switch (_randomType)
        {
            case RandomType.NUMBER: SampleNumber(ref urand); break;
            case RandomType.VECTOR_2D: SampleVector2D(ref urand); break;
            case RandomType.VECTOR_3D: SampleVector3D(ref urand); break;
            case RandomType.COLOR: SampleColor(ref urand); break;
            case RandomType.DICE: SampleDice(ref urand); break;
            case RandomType.SHUFFLEBAG: SampleShuffle(ref urand); break;
            case RandomType.WEIGHTEDBAG: SampleWShuffle(ref urand); break;
            default: SampleNumber(ref urand); break;
        }

        this.Repaint();
    }
    private void SampleNumber(ref UnityRandom _urand)
    {
        for (int i = 0; i < samplig_size; i++)
        {
            switch (_randomNumberType) {

            case RandomNumberType.VALUE:
                if (transform) {
                    randomList.Add(_urand.Value( normalization, temperature ));
                } else {
                 	randomList.Add(_urand.Value());
                }
            break;

            case RandomNumberType.RANGE:
                if (transform) {
                    randomList.Add(_urand.Range(_range_min, _range_max, normalization, temperature ));
                } else {
                 	randomList.Add(_urand.Range(_range_min, _range_max));
                }
            break;

            case RandomNumberType.POISSON:
                randomList.Add(_urand.Possion(temperature));
            break;

            case RandomNumberType.EXPONENTIAL:
                randomList.Add(_urand.Exponential(temperature));
            break;

            case RandomNumberType.GAMMA:
                randomList.Add(_urand.Gamma(temperature));
            break;

            default:
            break;
            }
        }
        randomList.Sort();
    }
 private void SampleDice(ref UnityRandom _urand)
 {
     for (int i = 0; i < samplig_size; i++)
     {
         randomList.Add( _urand.RollDice(nroll, dice));
     }
 }
 private void SampleColor(ref UnityRandom _urand)
 {
     for (int i = 0; i < samplig_size; i++)
     {
         if (transform) {
             randomList.Add(_urand.Rainbow(normalization,temperature));
         } else {
             randomList.Add(_urand.Rainbow());
         }
     }
 }
	public static UnityRandom get_channel(string key){
		if (!channels.ContainsKey(key)){
			channels[key] = new UnityRandom();
		}
		return channels[key];
	}