public int pick_my_NoisyPDF(double[] pdf, int size,double chance)
    {
        double maxrate=-1;
        int maxix=-1;
        int tryc=0;
        //have to return something
        if (max_value_after_softmax==-1)
        {
            System.err.println("HEY NoisyPDF: no max value set by softmax!!");
            return (int)(size*Math.random());
        }
        //have to return something
        if (max_value_after_softmax<=1e-40)
        {
            System.err.println("HEY NoisyPDF: maxvalue set by softmax is:"+max_value_after_softmax);
            return (int)(size*Math.random());
        }
        // if randomness lets we return now
        if (Math.random()<chance)
            return  (int)(size*Math.random());

        while (maxix==-1 && tryc++<5)
        {
            for (int i=0;i<size;i++)
            {
                double p=(pdf[i]/max_value_after_softmax);
                // fires
                if (Math.random()<p)
                {
                    // with this rate
                    double rate=Math.random();
                    // winner till now ?
                    if (rate>maxrate)
                    {
                        maxrate=rate;
                        maxix=i;
                    }
                }
            }
            if (maxix==-1)
            {
                System.out.println(HV.setInfo("WARNING: no one fired in trial (my_noisypdf):"+tryc));
            }
            else
            {
                return maxix;
            }
        }
        //have to return something
        return (int)(size*Math.random());
    }