
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
A functional typescript implementation of the PCG family random number generators
A functional implementation of the PCG family random number generators, written in JavaScript.
To achieve frictionless reproducibility of random output results, immutable objects are used throughout the project.
Firstly, create a random number engine:
import { createPcg32 } from 'pcg'
const advancedOptions = {}
const initState = 42
const initStreamId = 54
const state0 = createPcg32(advancedOptions, initState, initStreamId)
After that, random outputs can be generated by calling appropriate functions as shown below:
import { nextState, prevState, randomInt, randomList } from 'pcg'
const randomUint32 = randomInt(0, 2 ** 32 - 1)
const [value, nextState] = randomUint32(state0)
const listLength = 3
const listItemRng = randomUint32
const [[v1, state1], [v2, state2], [v3, state3]] = randomList(listLength, listItemRng, state0)
In this above example, value === v1
, and nextState === state1
FAQs
A functional typescript implementation of the PCG family random number generators
The npm package fn-pcg receives a total of 750 weekly downloads. As such, fn-pcg popularity was classified as not popular.
We found that fn-pcg 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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.