New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

randoma

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

randoma - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

16

index.js
'use strict';
const ParkMiller = require('park-miller');
const stringHash = require('@sindresorhus/string-hash');
const color = require('color');
const MAX_INT32 = 2147483647;
const GOLDEN_RATIO_CONJUGATE = 0.618033988749895;

@@ -49,4 +51,18 @@ module.exports = class {

}
color(saturation) {
saturation = saturation || 0.5;
let hue = this.float();
hue += GOLDEN_RATIO_CONJUGATE;
hue %= 1;
return color({
h: hue * 360,
s: saturation * 100,
v: 95
});
}
};
module.exports.seed = () => Math.floor(Math.random() * MAX_INT32);

3

package.json
{
"name": "randoma",
"version": "1.0.0",
"version": "1.1.0",
"description": "User-friendly pseudorandom number generator (PRNG)",

@@ -39,2 +39,3 @@ "license": "MIT",

"@sindresorhus/string-hash": "^1.0.0",
"color": "^2.0.1",
"park-miller": "^1.0.0"

@@ -41,0 +42,0 @@ },

@@ -60,2 +60,18 @@ # randoma [![Build Status](https://travis-ci.org/sindresorhus/randoma.svg?branch=master)](https://travis-ci.org/sindresorhus/randoma)

#### random.color([saturation])
Returns a random [aesthetically pleasing color](https://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/) as a [`color`](https://github.com/Qix-/color) object.
```js
random.color(0.5).hex().toString()
//=> '#AAF2B0'
```
##### saturation
Type: `number`<br>
Default: `0.5`
Saturation percentage in the range `0...1`.
*"Pull request welcome" for additional commonly used random methods.*

@@ -62,0 +78,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc