- initialize it with a random speed;
- exponentially decay it down to a threshold; keep count of how long it takes to go down to that threshold;
- random generate a number between 0..1;
- if that number if >= 0.5, round up / or down the count;
- all the time, display that count.
It should be fairly simple.