import {
  map
} from "./chunk-DHOW4GBY.mjs";
import {
  pipe
} from "./chunk-ZI34HWXZ.mjs";
import {
  __export
} from "./chunk-QK4PKNB3.mjs";

// src/Random.ts
var Random_exports = {};
__export(Random_exports, {
  random: () => random,
  randomBool: () => randomBool,
  randomElem: () => randomElem,
  randomInt: () => randomInt,
  randomRange: () => randomRange
});
var random = () => Math.random();
function randomInt(low, high) {
  return pipe(
    random,
    map((n) => Math.floor((high - low + 1) * n + low))
  );
}
function randomRange(min, max) {
  return pipe(
    random,
    map((n) => (max - min) * n + min)
  );
}
var randomBool = /* @__PURE__ */ pipe(
  random,
  map((n) => n < 0.5)
);
var randomElem = (as) => pipe(
  randomInt(0, as.length - 1),
  map((i) => as[i])
);

export {
  random,
  randomInt,
  randomRange,
  randomBool,
  randomElem,
  Random_exports
};
