I already asked this question on stackoverflow -- I am posting it here as well, because I think many of you will have encountered an analogous problem. I would appreciate even a link as a reference, or the name of a relevant topic (even if you don't explain the solution).

So, my reason for this question: I want a metronome that sporadically changes tempo -- I use the metronome during my boxing drills (if you are curious, mostly for jump rope or any footwork). I can script a metronome rather easily by requesting an audio file over a loop -- Also, I can think of ways (perhaps not all elegant) to to change tempo after certain increments of my defined time unit have passed. But if I wanted that, I certainly wouldn't have come to this forum.

A metronome that randomly changes tempos would be invaluable for my purposes (I won't elaborate on them, as they aren't relevant to the forum). I can't think of a way to accomplish this on my own -- Regrettably, I never took an pure algorithms course, since I thought I wouldn't need it for physics. I'm sure there is an obvious one I could recall if I had, and can't figure out a general form on my own.

It doesn't matter what language the script is in -- in fact, a basic form would be better for me to work with.

I hope someone can point me in the right direction, and I would be extremely grateful, thanks

  • Sorry, but the SE network's communities are strongly against crossposts, even if a question could be on-topic on more than one site. Please pick one the dupes and delete the other ASAP. Thanks.
    – Doc Brown
    Commented Jan 28, 2021 at 20:51

1 Answer 1


All you really have to do is to figure out

  • how to generate random numbers within a given range
  • how to write a bounded loop of the form "Do action X, Y times"

How this works totally depends on your programming language/environment. But once you can do these two things, the algorithm is simply

  1. generate suitable values of X and Y
  2. play X clicks at frequency Y
  3. repeat
  • I knew the answer would be simple, I just needed someone to take the time to answer such a strange question - I know you can't really know, but this question was very important to my actual routine, and people at my gym are going to go crazy. I love this site, thanks ! Commented Jan 28, 2021 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.