Browser implementation of Ronald L. Rivest's sampling algorithm using AngularJS