Euclidean rhythm demo code, ★ on Github
The Euclidean rhythm in music was discovered by Godfried Toussaint in 2004 and is described in a 2005 paper "The Euclidean Algorithm Generates Traditional Musical Rhythms".[1] The greatest common divisor of two numbers is used rhythmically giving the number of beats and silences, generating almost all of the most important World Music rhythms,[2] (except Indian).[3] The beats in the resulting rhythms are as equidistant as possible; the same results can be obtained from the Bresenham algorithm.
Wikipedia, Euclidean rhythm