LCOV - code coverage report
Current view: top level - dashql-app/src/utils - prng.ts Coverage Total Hit
Test: DashQL 915828b Lines: 100.0 % 23 23
Test Date: 2026-11-06 19:30:32

            Line data    Source code
       1              : export interface PseudoRandomNumberGenerator {
       2              :     next(): number;
       3              : }
       4              : 
       5            1 : export class TycheI implements PseudoRandomNumberGenerator {
       6            1 :     a: number;
       7            1 :     b: number;
       8            1 :     c: number;
       9            1 :     d: number;
      10              : 
      11            1 :     constructor(a: number, b: number, c: number, d: number) {
      12            1 :         this.a = a;
      13            1 :         this.b = b;
      14            1 :         this.c = c;
      15            1 :         this.d = d;
      16            1 :     }
      17              : 
      18            1 :     public nextI32(): number {
      19            1 :         this.a |= 0; this.b |= 0; this.c |= 0; this.d |= 0;
      20            1 :         this.b = (this.b << 25 | this.b >>> 7) ^ this.c; this.c = this.c - this.d | 0;
      21            1 :         this.d = (this.d << 24 | this.d >>> 8) ^ this.a; this.a = this.a - this.b | 0;
      22            1 :         this.b = (this.b << 20 | this.b >>> 12) ^ this.c; this.c = this.c - this.d | 0;
      23            1 :         this.d = (this.d << 16 | this.d >>> 16) ^ this.a; this.a = this.a - this.b | 0;
      24            1 :         return this.a >>> 0;
      25            1 :     }
      26              : 
      27            1 :     public next(): number {
      28            1 :         return Math.abs(this.nextI32() / 0xFFFFFFFF);
      29            1 :     }
      30            1 : }
        

Generated by: LCOV version 2.0-1