https://github.com/bddjr/webcrypto-random-int
πLike golang, get crypto random integer or bigint.π
https://github.com/bddjr/webcrypto-random-int
crypto randint random random-int random-integers randomint webcrypto
Last synced: 3 months ago
JSON representation
πLike golang, get crypto random integer or bigint.π
- Host: GitHub
- URL: https://github.com/bddjr/webcrypto-random-int
- Owner: bddjr
- License: mit
- Created: 2024-03-22T09:05:16.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-04-04T05:21:52.000Z (about 1 year ago)
- Last Synced: 2025-03-08T15:34:03.395Z (3 months ago)
- Topics: crypto, randint, random, random-int, random-integers, randomint, webcrypto
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/webcrypto-random-int
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# webcrypto-random-int
Like golang, get crypto random integer or bigint.
## NPM
```
npm i webcrypto-random-int --save-dev
```## Example
```js
import CryptoRandInt from "webcrypto-random-int";console.log("canIUse " + CryptoRandInt.canIUse);
if (CryptoRandInt.canIUse) {
console.log(CryptoRandInt.numInt(62));
console.log(CryptoRandInt.bigInt(2n ** 128n));
console.log(CryptoRandInt.str(
32,
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
));
}
```
```
canIUse true
53
216521706795757442119767567038153766458
SK2jwNqt3xvP1zuSwJt7CcxAI4T2GYbA
```## Test
```
npm -g i live-server
npm run example
```