Comparing version 0.1.0 to 1.0.0
123
package.json
{ | ||
"name": "pcg", | ||
"version": "0.1.0", | ||
"description": "A functional implementation of the PCG family random number generators, written in JavaScript", | ||
"main": "lib/index.js", | ||
"repository": "https://github.com/kripod/pcg", | ||
"author": "Kristóf Poduszló <kripod@protonmail.com>", | ||
"version": "1.0.0", | ||
"description": "A functional typescript implementation of the PCG family random number generators", | ||
"sideEffects": false, | ||
"main": "dist/index.js", | ||
"files": [ | ||
"/dist/", | ||
"!/dist/**/__tests__/*.js" | ||
], | ||
"repository": "https://github.com/philihp/pcg", | ||
"contributors": [ | ||
"Kristóf Poduszló <kripod@protonmail.com>", | ||
"Philihp Busby <philihp@gmail.com>" | ||
], | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "babel src -d lib -s", | ||
"lint": "eslint ./src", | ||
"test": "nyc -r lcov -r text ava -T 30s" | ||
"build": "tsc -p tsconfig.build.json", | ||
"lint": "eslint --ext .ts src", | ||
"prepare": "husky install && npm run build", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage", | ||
"test:watch": "jest --watch" | ||
}, | ||
"dependencies": { | ||
"long": "^3.2.0", | ||
"ramda": "^0.23.0" | ||
"long": "5.2.3", | ||
"ramda": "0.29.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.17.0", | ||
"babel-cli": "^6.18.0", | ||
"babel-preset-latest": "^6.16.0", | ||
"eslint": "^3.12.1", | ||
"eslint-config-airbnb-base": "^11.0.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"nyc": "^10.0.0" | ||
"@philihp/eslint-config": "6.0.2", | ||
"@philihp/prettier-config": "1.0.0", | ||
"@tsconfig/node20": "1.0.0", | ||
"@types/jest": "29.5.1", | ||
"@types/ramda": "0.29.1", | ||
"@typescript-eslint/eslint-plugin": "5.59.2", | ||
"@typescript-eslint/parser": "5.59.2", | ||
"eslint": "8.40.0", | ||
"eslint-import-resolver-typescript": "3.5.5", | ||
"eslint-plugin-import": "2.27.5", | ||
"husky": "8.0.3", | ||
"jest": "29.5.0", | ||
"lint-staged": "13.2.2", | ||
"prettier": "2.8.8", | ||
"ts-jest": "29.1.0", | ||
"typescript": "5.0.4" | ||
}, | ||
"lint-staged": { | ||
"src/**/*.ts": [ | ||
"eslint --ext .ts --fix" | ||
] | ||
}, | ||
"jest": { | ||
"preset": "ts-jest", | ||
"modulePathIgnorePatterns": [ | ||
"dist/" | ||
] | ||
}, | ||
"prettier": "@philihp/prettier-config", | ||
"eslintConfig": { | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"extends": [ | ||
"@philihp", | ||
"plugin:jest/all", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"settings": { | ||
"react": { | ||
"version": "18.2.0" | ||
}, | ||
"import/extensions": [ | ||
".js", | ||
".ts" | ||
], | ||
"import/parsers": { | ||
"@typescript-eslint/parser": [ | ||
".ts", | ||
".js" | ||
] | ||
}, | ||
"import/resolver": { | ||
"typescript": {}, | ||
"node": { | ||
"extensions": [ | ||
".js", | ||
".ts" | ||
] | ||
} | ||
} | ||
}, | ||
"rules": { | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
"js": "never", | ||
"ts": "never" | ||
} | ||
], | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ | ||
"argsIgnorePattern": "_", | ||
"varsIgnorePattern": "_", | ||
"caughtErrorsIgnorePattern": "_" | ||
} | ||
], | ||
"jest/max-expects": "off" | ||
} | ||
} | ||
} |
@@ -1,6 +0,8 @@ | ||
# pcg.js | ||
# pcg | ||
[](https://www.npmjs.com/package/pcg) | ||
[](https://travis-ci.org/kripod/pcg.js) | ||
[](https://codecov.io/gh/kripod/pcg.js) | ||
[](https://www.npmjs.com/package/pcg) | ||
[](https://github.com/philihp/pcg/actions/workflows/tests.yml) | ||
[](https://coveralls.io/github/philihp/pcg?branch=main) | ||
 | ||
 | ||
@@ -15,11 +17,11 @@ A functional implementation of the [PCG family random number generators](), written in JavaScript. | ||
Firstly, create a random number engine: | ||
First, seed a PCG state. A stream ID specifies _which_ unique periodic series of entropy to use. The state specifies _where_ in that series we start. | ||
```js | ||
import { createPcg32 } from 'pcg'; | ||
``` | ||
import { createPcg32 } from 'pcg' | ||
const advancedOptions = {}; | ||
const initState = 42; | ||
const initStreamId = 54; | ||
const pcg = createPcg32(advancedOptions, initState, initStreamId); | ||
const advancedOptions = {} | ||
const initState = 42 | ||
const initStreamId = 54 | ||
const state0 = createPcg32(advancedOptions, initState, initStreamId) | ||
``` | ||
@@ -30,10 +32,16 @@ | ||
```js | ||
import { nextState, prevState, randomInt, randomList } from 'pcg'; | ||
import { nextState, prevState, randomInt, randomList } from 'fn-pcg' | ||
const randomUint32 = randomInt(0, (2 ** 32) - 1); | ||
let [value, nextPcg] = randomUint32(pcg); | ||
const randomUint32 = randomInt(0, 2 ** 32 - 1) | ||
const [value, nextState] = randomUint32(state0) | ||
const listLength = 6; | ||
const listItemRng = randomUint32; | ||
[value, nextPcg] = randomList(listLength, listItemRng, pcg); | ||
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` | ||
## Thanks | ||
- [@kripod](https://github.com/kripod/), who wrote the original [`pcg.js`](https://github.com/kripod/pcg.js) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
46
14992
16
13
194
2
+ Addedlong@5.2.3(transitive)
+ Addedramda@0.29.0(transitive)
- Removedlong@3.2.0(transitive)
- Removedramda@0.23.0(transitive)
Updatedlong@5.2.3
Updatedramda@0.29.0