export const ensure = <T>(value: T, message: string): T => {
  if (value === undefined || value === null) {
    throw new Error(message)
  }

  return value
}

export const random = <T>(arr: ReadonlyArray<T>): T => {
  return arr[Math.floor(Math.random() * arr.length)]!
}
