deno_std icon indicating copy to clipboard operation
deno_std copied to clipboard

[Suggestion] A module that includes BigInt utilities

Open rojvv opened this issue 1 year ago • 0 comments

BigInt utilities include, but are not limited to:

  • A function that takes in x, y, z, and calculates a (x ** y) % z to power, like Python’s built-in pow. Why not just do (x ** y) % z? Because it is really slow for large ints, and there are faster ways.
  • A function that converts Uint8Arrays to BigInts (with support for signed BigInts).
  • A function that converts BigInts to Uint8Arrays (with support for signed BigInts).
  • A function that takes n, and returns a random BigInt that has a maximum byte length of n.
  • A function that takes min, max, and returns a random BigInt in that range.
  • Alternative to Math.min, Math.max.

rojvv avatar Apr 07 '24 19:04 rojvv