/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Bytes } from "#util/Bytes.js";
class Entropy {
  get randomUint8() {
    return Bytes.of(this.randomBytes(1))[0];
  }
  get randomUint16() {
    return Bytes.dataViewOf(this.randomBytes(2)).getUint16(0);
  }
  get randomUint32() {
    return Bytes.dataViewOf(this.randomBytes(4)).getUint32(0);
  }
  get randomBigUint64() {
    return Bytes.dataViewOf(this.randomBytes(8)).getBigUint64(0);
  }
  randomBigInt(size, maxValue) {
    if (maxValue === void 0) {
      return Bytes.asBigInt(this.randomBytes(size));
    }
    while (true) {
      const random = Bytes.asBigInt(this.randomBytes(size));
      if (random < maxValue) return random;
    }
  }
}
export {
  Entropy
};
//# sourceMappingURL=Entropy.js.map
