MCPcopy Index your code
hub / github.com/Effect-TS/effect / constructor

Method constructor

packages/effect/src/Utils.ts:553–585  ·  view source on GitHub ↗
(
    seedHi?: OptionalNumber,
    seedLo?: OptionalNumber,
    incHi?: OptionalNumber,
    incLo?: OptionalNumber
  )

Source from the content-addressed store, hash-verified

551 incLo: OptionalNumber
552 )
553 constructor(
554 seedHi?: OptionalNumber,
555 seedLo?: OptionalNumber,
556 incHi?: OptionalNumber,
557 incLo?: OptionalNumber
558 ) {
559 if (isNullable(seedLo) && isNullable(seedHi)) {
560 seedLo = (Math.random() * 0xffffffff) >>> 0
561 seedHi = 0
562 } else if (isNullable(seedLo)) {
563 seedLo = seedHi
564 seedHi = 0
565 }
566 if (isNullable(incLo) && isNullable(incHi)) {
567 incLo = this._state ? this._state[3] : defaultIncLo
568 incHi = this._state ? this._state[2] : defaultIncHi
569 } else if (isNullable(incLo)) {
570 incLo = <number> incHi
571 incHi = 0
572 }
573
574 this._state = new Int32Array([0, 0, (<number> incHi) >>> 0, ((incLo || 0) | 1) >>> 0])
575 this._next()
576 add64(
577 this._state,
578 this._state[0]!,
579 this._state[1]!,
580 (<number> seedHi) >>> 0,
581 (<number> seedLo) >>> 0
582 )
583 this._next()
584 return this
585 }
586
587 /**
588 * Returns a copy of the internal state of this random number generator as a

Callers

nothing calls this directly

Calls 3

_nextMethod · 0.95
isNullableFunction · 0.85
add64Function · 0.85

Tested by

no test coverage detected