![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
easyseed
Advanced tools
Readme
___________ _________ .___ \_ _____/____ _________.__./ _____/ ____ ____ __| _/ | __)_\__ \ / ___| | |\_____ \_/ __ \_/ __ \ / __ | | \/ __ \_\___ \ \___ |/ \ ___/\ ___// /_/ | /_______ (____ /____ >/ ____/_______ /\___ >\___ >____ | EasySeed\/ \/ \/ \/ \/ \/ \/ \/
EasySeed is seedable random number generator that utilizes David Bau's seedable random number generator internally(with a few minor changes for Node.js support), and provides an easy interface for seeding and using the generator.
Note: A generator of this nature is only as random as the seed provided.
Simply require, seed, and use.
var easyseed = require('easyseed');
easyseed.seed.auto();
easyseed.float(function(n) {
console.log(n); //0.3234234223442
});
Before any values can be generated, the generator must be seeded. All seed types are part of the easyseed.seed
namespace.
Seeds the generator with the current data/time. Useful for general purpose pseudo-random numbers.
Seeds the generator with the specified string.
Seeds the generator is the data within the provided buffer.
Makes a request for the specificed web resource and uses the response body as the seed for the generator.
Loads a file, then uses the contents as the seed for the generator.
EasySeed gives you the option to get random integers or floats.
Note: Internally a queue is used to hold generation while seeding is done. This is required since some seeding options require asynchronous operations, such as making HTTP requests or reading files. This means callbacks are required for all generators.
Generates an integer between min and max, 0 and max, or 0-1. The callback is called with the number generated.
//require and seed it...
var print = function(n) {
console.log(n);
};
easyseed.int(print); //0 or 1
easyseed.int(10, print); //between 0 and 10
easyseed.int(50, 100, print); //between 50 and 100
Same as easyseed.int
, expect a floating point number is returned. easyseed.float(callback)
(no min/max) generates exactly what Math.random
does.
There are a couple events you can subscribe to if needed.
Fires when a request of filesystem error occurs for the corresponding seed functions.
Fires when seeding is complete, and provides the seed string used.
The tests provided simply seed using all the seed functions, then generate 2000 0-1 floats (Math.random
), 2000 floats between 10 and 100, and 2000 integers between 10 and 100. Node.js' Assert is used for validation. Errors are thrown if a request or filesystem error occurs.
node test.js
FAQs
A seedable random number generator.
The npm package easyseed receives a total of 2 weekly downloads. As such, easyseed popularity was classified as not popular.
We found that easyseed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.