docs: public static final byte selectRandom(frequency[] a) {
          int len = a.length;
          double r = random(1.0);
          for (int i = 0; i < len; i++)
              if (r < a[i].p)
                  return a[i].c;
          return a[len - 1].c;
      }