https://github.com/jacob-ian/deno_random_bigint
Generate a random BigInt by bit-length with Deno.
https://github.com/jacob-ian/deno_random_bigint
cryptography deno typescript
Last synced: about 2 months ago
JSON representation
Generate a random BigInt by bit-length with Deno.
- Host: GitHub
- URL: https://github.com/jacob-ian/deno_random_bigint
- Owner: jacob-ian
- License: mit
- Created: 2020-07-04T08:04:59.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-17T07:59:35.000Z (almost 6 years ago)
- Last Synced: 2024-10-26T06:52:09.200Z (over 1 year ago)
- Topics: cryptography, deno, typescript
- Language: TypeScript
- Homepage:
- Size: 22.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Deno Random BigInt Generator 🦕
A random integer generator made for Deno.
It can generate a random integer with a `bigint` type from either:
* a desired bit-length (e.g. 2048-bit); or
* a desired range.
*Created by Jacob Ian Matthews - [Website](https://jacobianmatthews.com) | [GitHub](https://github.com/jacob-ian)*
## Usage
### Generate a Random BigInt from a Bit Length
```typescript
import { randomBigIntBits } from "https://deno.land/x/random_bigint/mod.ts";
// Choose a bit-length
const bitlength = 2048;
// Create the random bigint
const random = randomBigIntBits(bitlength); // or randomBigInt(2048)
```
### Generate a Random BigInt from a Range
```typescript
import { randomBigIntRange } from "https://deno.land/x/random_bigint/mod.ts"
// Choose a minimum and maximum integer value
const min = 1n;
const max = 2**2048n;
// Generate the bigint
const random = randomBigIntRange(min, max);
```
## License
MIT License.