版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

40 строки
1.2 KiB

  1. /**
  2. * @since 2.0.0
  3. */
  4. import { IO } from './IO'
  5. import { ReadonlyNonEmptyArray } from './ReadonlyNonEmptyArray'
  6. /**
  7. * Returns a random number between 0 (inclusive) and 1 (exclusive). This is a direct wrapper around JavaScript's
  8. * `Math.random()`.
  9. *
  10. * @since 2.0.0
  11. */
  12. export declare const random: IO<number>
  13. /**
  14. * Takes a range specified by `low` (the first argument) and `high` (the second), and returns a random integer uniformly
  15. * distributed in the closed interval `[low, high]`. It is unspecified what happens if `low > high`, or if either of
  16. * `low` or `high` is not an integer.
  17. *
  18. * @since 2.0.0
  19. */
  20. export declare function randomInt(low: number, high: number): IO<number>
  21. /**
  22. * Returns a random number between a minimum value (inclusive) and a maximum value (exclusive). It is unspecified what
  23. * happens if `maximum < minimum`.
  24. *
  25. * @since 2.0.0
  26. */
  27. export declare function randomRange(min: number, max: number): IO<number>
  28. /**
  29. * Returns a random boolean value with an equal chance of being `true` or `false`
  30. *
  31. * @since 2.0.0
  32. */
  33. export declare const randomBool: IO<boolean>
  34. /**
  35. * Returns a random element of a `ReadonlyNonEmptyArray`.
  36. *
  37. * @since 2.10.0
  38. */
  39. export declare const randomElem: <A>(as: ReadonlyNonEmptyArray<A>) => IO<A>