An actively mode-locked laser with tunable repetition rate is proposed and experimentally demonstrated based on a programmable electrical pattern generator. By changing the repetition rate of the electrical patterns applied on the in-cavity modulator, the repetition rate of the output optical pulse sequences changes accordingly while the pulse width of the optical pulse train remains almost constant. In other words, the output ultra-short pulse train has a tunable duty cycle. In a proof-of-principle experiment, optical pulses with repetition rates of 10, 5, 2.5 and 1.25 GHz are obtained by adjusting the electrical pattern applied on the in-cavity modulator while their pulse widths remain almost unchanged.