
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
sutor-random
Advanced tools
A naïve seeded pseudo-random number generator for JS. This is mainly meant for testing purposes: the method used is reportedly ~2-3 times slower than Math.random()
.
reduce
)npm install
into project.
// import all functions under the `Random` namespace:
import Random from 'sutor-random'
// use like:
Random.seeded()
Random.intBetween(10, 20)
// import specific functions
import { seeded, intBetween} from 'sutor-random'
// use like:
seeded()
intBetween(10, 20)
Random.seeded([seed])
Returns a random value between zero and one inclusive. Functionally identical to Math.random()
. If the optional seed is passed, values become predictable.
> Random.seeded(1)
0.7098480789645691
Random.intBetween(min, max[, seed])
Returns a random integer between min and max inclusive. If the optional seed is passed, values become predictable.
> Random.intBetween(10, 20, 1)
17
Random.intUpTo(max[, seed])
Returns a random integer between zero and max inclusive. If the optional seed is passed, values become predictable.
> Random.intBetween(20, 1)
14
Random.shuffle(array[, seed])
Shuffles an array randomly, using Random.seeded()
+ a privately-defined shuffle function. If the optional seed is passed, values become predictable.
> Random.shuffle([1,2,3,4,5,6], 20)
[2,4,6,3,1,5]
FAQs
A naïve seeded PRNG implementation.
The npm package sutor-random receives a total of 3 weekly downloads. As such, sutor-random popularity was classified as not popular.
We found that sutor-random 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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.