// START a FLOAT SHUFFLE BAG
    // Note the a value can be shuffled with himself
    public ShuffleBagCollection <float> ShuffleBag(float[] values)
    {
        var bag = new ShuffleBagCollection <float>();

        foreach (var x in values)
        {
            bag.Add(x);
        }
        return(bag);
    }
Example #2
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();
    }
Example #3
0
    // START a WIGHTED FLOAT SHUFFLE BAG, the trick is the it is added many times
    // Note the a value can be shuffled with himself
    public ShuffleBagCollection <float> ShuffleBag(Dictionary <float, int> dict)
    {
        ShuffleBagCollection <float> bag = new ShuffleBagCollection <float>();

        foreach (KeyValuePair <float, int> x in dict)
        {
            //Debug.Log(x.Value);
            int   val = x.Value;
            float key = x.Key;
            bag.Add(key, val);
        }
        return(bag);
    }
    // START a WIGHTED FLOAT SHUFFLE BAG, the trick is the it is added many times
    // Note the a value can be shuffled with himself
    public ShuffleBagCollection <float> ShuffleBag(Dictionary <float, int> dict)
    {
        var bag = new ShuffleBagCollection <float>();

        foreach (var x in dict)
        {
            //Debug.Log(x.Value);
            var val = x.Value;
            var key = x.Key;
            bag.Add(key, val);
        }

        return(bag);
    }
Example #5
0
    // 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();
    }
Example #6
0
	// START a WIGHTED FLOAT SHUFFLE BAG, the trick is the it is added many times
	// Note the a value can be shuffled with himself
	public ShuffleBagCollection<float> ShuffleBag(Dictionary<float,int> dict)
	{
		ShuffleBagCollection<float> bag = new ShuffleBagCollection<float>();
		foreach (KeyValuePair<float, int> x in dict)
		{
			//Debug.Log(x.Value);
			int val = x.Value;
			float key = x.Key;
			bag.Add( key, val);
		}
		return bag;
	}
Example #7
0
	// START a FLOAT SHUFFLE BAG
	// Note the a value can be shuffled with himself
	public ShuffleBagCollection<float> ShuffleBag(float[] values)
	{
		ShuffleBagCollection<float> bag = new ShuffleBagCollection<float>();
		foreach (float x in values)
		{
			bag.Add(x);
		}
		return bag;
	}