@Override
	public void setProbability(double[] p, Map<String,Integer> stateToIndex) throws IllegalArgumentException {
		
		if( p == null)
			throw new IllegalArgumentException("Error: null probability distribution");
		double sum = 0.0;
		for( int i = 0; i < p.length; ++i) {
			sum += p[i];
			if( Double.isNaN(p[i]))
				throw new IllegalArgumentException("Error: NaN probability value");
			if(p[i] < 0)
				throw new IllegalArgumentException("Error: probability value smaller then 0");
			if(p[i] > 1)
				throw new IllegalArgumentException("Error: probability value bigger then 1");
		}
		if( sum + 0.0001 < 1.0 || sum - 0.0001 > 1.0)
			throw new IllegalArgumentException("Error: probability distribution doesn't sum 1");
		
		this.pDistr = p;
		this.stateToIndex = stateToIndex;
	}