1.0.1 • Published 8 years ago

random-depth v1.0.1

Weekly downloads
6
License
MIT
Repository
github
Last release
8 years ago

random-depth

Generate a random depth, in meters. Depths are always negative.

MIT License

build:? coverage:?

Install

$ npm install --save random-depth 

Usage

var randomDepth = require('random-depth');

// API
// - randomDepth();
// - randomDepth(options);

// options:
// - min  : default -10994
// - max  : default 0
// - fixed: default 5

randomDepth();
// => -2126.95039

By default, includes 5 digits of accuracy after the decimal. Can override with the fixed option.

randomDepth({ fixed: 2 })
// => -1542.11

By default, maximum (or minimum depending on your frame of reference) depth of -2550 (depth of the Mariana Trench), but this can be overridden with the min option.

randomDepth({ min: -1000 })
// => -718.41976

Related

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.