# set-random-interval

> An adaptation of JavaScript's native setInterval() function, allowing for random intervals.

Latest version **1.1.0** (published 2020-02-19) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install set-random-interval
pnpm add set-random-interval
yarn add set-random-interval
bun add set-random-interval
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-02-19 |
| First published | 2018-06-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jason Bacchetta |
| Maintainers | jabacchetta |
| Keywords | javascript, setInterval, random, animations, game-development |

## Links

- npm: https://www.npmjs.com/package/set-random-interval
- Repository: https://github.com/jabacchetta/set-random-interval
- Homepage: https://github.com/jabacchetta/set-random-interval#readme
- Issues: https://github.com/jabacchetta/set-random-interval/issues
- npm.io page: https://npm.io/package/set-random-interval

## Dependencies (1)

- [typescript](https://npm.io/package/typescript.md) ^3.6.3

## Alternatives

- [@luma.gl/experimental](https://npm.io/package/@luma.gl/experimental.md) — 77.1K weekly downloads
- [persona-harness](https://npm.io/package/persona-harness.md) — 4.7K weekly downloads
- [@tsparticles/effect-bubble](https://npm.io/package/@tsparticles/effect-bubble.md) — 4.6K weekly downloads
- [f3d](https://npm.io/package/f3d.md) — 730 weekly downloads
- [spark-html-motion](https://npm.io/package/spark-html-motion.md) — 298 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2020-02-19
- 1.0.1 — 2018-06-18
- 1.0.0 — 2018-06-14

## README

# setRandomInterval

setRandomInterval is an adaptation of
[JavaScript's native `setInterval()`function](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval),
allowing for both a minimum and maximum delay to be passed in, which is then used to invoke the
callback at random intervals within the given range.

## Purpose

There may be times where you'd like repetitive function calls to be executed on a more
naturally-occurring timeline, as opposed to executing at fixed intervals. This is often the case
when trying to emulate the real world in game development.

## Installation

```sh
npm i set-random-interval
```

## Usage

```javascript
import setRandomInterval from 'set-random-interval';

// Pass in the callback, minimum delay (milliseconds), and maximum delay (milliseconds).
const interval = setRandomInterval(() => console.log('Hello World!'), 1000, 5000);

// Clear the interval if/when you'd like.
interval.clear();
```

---
_Source: https://npm.io/package/set-random-interval · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
