
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
A tiny pseudo-random number generator.
var arbit = require('arbit');
var random = arbit();
var HIT_CHANCE = 0.75;
var MIN_DAMAGE = 15, MAX_DAMAGE = 21;
if (random() <= HIT_CHANCE) {
var damage = random.nextInt(MIN_DAMAGE, MAX_DAMAGE);
console.log('You hit the zombie for %d damage!', damage);
} else {
console.log('You missed!');
}
var generator = arbit(seed)
The package itself is just a single function which returns a number generator using the provided seed.
var generator = arbit.fromState(state)
Returns a number generator initialized to be in the provided state.
var number = generator()
Calling the generator itself returns a value greater than or equal to zero, and less than one.
var number = generator.nextFloat(max)
Returns a floating point that somewhere between zero and max
. If a
negative number is provided, the range will instead be (max, 0]
.
var number = generator.nextFloat(min, max)
Returns a floating point number within either the range [min, max)
or
(max, min]
(if the range is reversed).
var number = generator.nextInt(max)
Same as nextFloat(max)
, but coerces the value to an integer with
Math.floor
.
var number = generator.nextInt(min, max)
Same as nextFloat(min, max)
, but coerces the value to an integer with
Math.floor
.
var state = generator.getState()
Returns the current state of the generator. This can be passed into
arbit.fromState(state)
to get back another generator in the same
state (i.e., it will generate the same sequence of numbers).
FAQs
A tiny pseudo-random number generator.
The npm package arbit receives a total of 53 weekly downloads. As such, arbit popularity was classified as not popular.
We found that arbit 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.