private int setNoteHeight(int nbupper1, int nbunder1, int nbupper2, int nbunder2) {
        int i;
        int h = 0;
        double tmp;

        // FIRST CASE alone Key

        if (noteLevel.isCurrentKeyTreble() || noteLevel.isCurrentKeyBass()) {

            tmp = Math.random();
            if (tmp < 0.5) {
                i = (int)Math.round((Math.random() * nbupper1));
            }   // between 0 and upper note
            else {
                i = -(int)Math.round((Math.random() * nbunder1));
            }
            // negative number berween under note and 0
            if (noteLevel.isCurrentKeyTreble()) {
                h = (scoreYpos + noteLevel.getBasetreble()) - (i * 5); // 20 for trebble key
            } else {
                h = (scoreYpos + noteLevel.getBasebass()) - (i * 5); // 4 far bass key
            }
            //   scoreYpos+20  =  Sol en clï¿½ de sol  128 = Fa en clï¿½ de fa
        }

        // SECOND CASE double Key
        else if (noteLevel.isCurrentKeyBoth()) {
            int dessousbase;
            if (nbupper2 < 0) {
                dessousbase = nbupper2;
            } else {
                dessousbase = 0;
            }

            double tmpcle = Math.random();
            if (tmpcle < 0.5) { // trebble key
                tmp = Math.random();
                if (tmp < 0.5) {
                    i = (int)Math.round((Math.random() * nbupper1));
                }             // between 0 and upper note
                else {
                    i = -(int)Math.round((Math.random() * nbunder1));
                }
                // negative number berween under note and 0
                h = scoreYpos + noteLevel.getBasetreble() - (i * 5);     //   scoreYpos+20  =  Sol en clï¿½ de sol
            } else {       // clï¿½ de fa
                tmp = Math.random();
                if (tmp < 0.5) {
                    i = (int)Math.round((Math.random() * nbupper2) + dessousbase);

                } else {
                    i = -(int)Math.round((Math.random() * nbunder2)) + dessousbase;
                }

                h = scoreYpos + noteLevel.getBasebass() + 90 - (i * 5);
            }
        }
        return h;
    }