(buffer: Uint8Array)
| 19 | this.filledBuffer = this.buffer; |
| 20 | } |
| 21 | private fillBufferDirect(buffer: Uint8Array): Uint8Array { |
| 22 | if ((buffer.length % seedRandomBlockSize) !== 0) throw new Error(`SeedRandomWrapper.fillBufferDirect should always be called with the buffer with the length a multiple-of-${seedRandomBlockSize}!`); |
| 23 | const length = buffer.length / seedRandomBlockSize; |
| 24 | const dataView = new DataView(buffer.buffer); |
| 25 | let byteOffset = 0; |
| 26 | for (let index = 0; index < length; index++, byteOffset += seedRandomBlockSize) { |
| 27 | dataView.setInt32(byteOffset, this.rng.int32(), false); |
| 28 | } |
| 29 | return buffer; |
| 30 | } |
| 31 | protected generateBigUintByBytes(bytes: number): bigint { |
| 32 | let u8a: Uint8Array<ArrayBufferLike> = new Uint8Array(Math.ceil(bytes / 8) * 8); |
| 33 | if (u8a.length < 1 || !Number.isSafeInteger(bytes)) return 0n; |
no outgoing calls
no test coverage detected