main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
305 bytes
|
Line | |
---|
1 | import { randomFillSync } from 'crypto';
|
---|
2 | const rnds8Pool = new Uint8Array(256);
|
---|
3 | let poolPtr = rnds8Pool.length;
|
---|
4 | export default function rng() {
|
---|
5 | if (poolPtr > rnds8Pool.length - 16) {
|
---|
6 | randomFillSync(rnds8Pool);
|
---|
7 | poolPtr = 0;
|
---|
8 | }
|
---|
9 | return rnds8Pool.slice(poolPtr, (poolPtr += 16));
|
---|
10 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.