Module onejoker::utils

source ·
Expand description

wiki | General utility functions

Functions that are probably available in the standard libraries for general use, but implemented here to be more specifically tailored and optimized for card games.

Structs§

Constants§

  • Lookup table for binomial coefficients up to 63c63, calculated additively with Pascal’s triangle method at compile time.

Functions§

  • wiki | Calculate binomial coefficient Calculate the binomial coefficient “n choose k” using a lookup table. Is only valid for n, k in the range 0..=63.
  • wiki | Iterate over combinations Given an array of indices into a larger array, increment the 0-based indices to the next k-combination, returning true when done.
  • wiki | Standard Fisher-Yates shuffle
  • wiki | Slightly specialized heapsort Heapsort optimized for small sets like poker hands, and in descending order which is most useful for ranking and displaying poker hands.