Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@thi.ng/random

Package Overview
Dependencies
Maintainers
1
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/random - npm Package Compare versions

Comparing version 0.1.1 to 1.0.0

lib/index.js

2

api.d.ts

@@ -1,2 +0,2 @@

import { ICopy } from "@thi.ng/api/api";
import { ICopy } from "@thi.ng/api";
export interface IRandom {

@@ -3,0 +3,0 @@ int(): number;

@@ -1,5 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const INV_MAX = 1 / 0xffffffff;
class ARandom {
export class ARandom {
float(norm = 1) {

@@ -31,2 +29,1 @@ return this.int() * INV_MAX * norm;

}
exports.ARandom = ARandom;

@@ -6,2 +6,24 @@ # Change Log

# [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/random@0.1.1...@thi.ng/random@1.0.0) (2019-01-21)
### Build System
* update package build scripts & outputs, imports in ~50 packages ([b54b703](https://github.com/thi-ng/umbrella/commit/b54b703))
### BREAKING CHANGES
* enabled multi-outputs (ES6 modules, CJS, UMD)
- build scripts now first build ES6 modules in package root, then call
`scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
- all imports MUST be updated to only refer to package level
(not individual files anymore). tree shaking in user land will get rid of
all unused imported symbols.
## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/random@0.1.0...@thi.ng/random@0.1.1) (2018-12-15)

@@ -8,0 +30,0 @@

@@ -1,11 +0,6 @@

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./api"));
__export(require("./smush32"));
__export(require("./system"));
__export(require("./xorshift128"));
__export(require("./xorwow"));
__export(require("./xsadd"));
export * from "./api";
export * from "./smush32";
export * from "./system";
export * from "./xorshift128";
export * from "./xorwow";
export * from "./xsadd";
{
"name": "@thi.ng/random",
"version": "0.1.1",
"version": "1.0.0",
"description": "Pseudo-random number generators w/ unified API",
"main": "./index.js",
"module": "./index.js",
"main": "./lib/index.js",
"umd:main": "./lib/index.umd.js",
"typings": "./index.d.ts",

@@ -15,8 +17,10 @@ "repository": {

"scripts": {
"build": "yarn run clean && tsc --declaration",
"clean": "rm -rf *.js *.d.ts .nyc_output build coverage doc",
"build": "yarn clean && yarn build:es6 && yarn build:bundle",
"build:es6": "tsc --declaration",
"build:bundle": "../../scripts/bundle-module random api",
"test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js",
"clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib",
"cover": "yarn test && nyc report --reporter=lcov",
"doc": "node_modules/.bin/typedoc --mode modules --out doc src",
"pub": "yarn run build && yarn publish --access public",
"test": "rm -rf build && tsc -p test && nyc mocha build/test/*.js"
"pub": "yarn build && yarn publish --access public"
},

@@ -28,7 +32,7 @@ "devDependencies": {

"nyc": "^13.1.0",
"typedoc": "^0.13.0",
"typedoc": "^0.14.0",
"typescript": "^3.2.2"
},
"dependencies": {
"@thi.ng/api": "^4.2.4"
"@thi.ng/api": "^5.0.0"
},

@@ -45,3 +49,4 @@ "keywords": [

},
"gitHead": "159ce8f6b1d2dad1e12f2ba3f4f7b60d1623acee"
"sideEffects": false,
"gitHead": "348e7303b8b4d2749a02dd43e3f78d711242e4fe"
}

@@ -46,5 +46,5 @@ # @thi.ng/random

```ts
import * as r from "@thi.ng/random";
import { Smush32 } from "@thi.ng/random";
const rnd = new r.Smush32(0xdecafbad);
const rnd = new Smush32(0xdecafbad);

@@ -51,0 +51,0 @@ // the following methods are available for all generators

@@ -1,2 +0,2 @@

import { IBuffered, ICopy } from "@thi.ng/api/api";
import { IBuffered, ICopy } from "@thi.ng/api";
import { ARandom, ISeedable } from "./api";

@@ -3,0 +3,0 @@ export declare class Smush32 extends ARandom implements IBuffered<Uint32Array>, ICopy<Smush32>, ISeedable<number> {

@@ -1,8 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const api_1 = require("./api");
import { ARandom } from "./api";
// https://github.com/thi-ng/ct-head/blob/master/random.h
// https://gist.github.com/voidqk/d112165a26b45244a65298933c0349a4
const DEFAULT_SEED = 0xdecafbad;
class Smush32 extends api_1.ARandom {
export class Smush32 extends ARandom {
constructor(seed = DEFAULT_SEED) {

@@ -29,2 +27,1 @@ super();

}
exports.Smush32 = Smush32;

@@ -1,6 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const api_1 = require("./api");
import { ARandom } from "./api";
const random = Math.random;
class SystemRandom extends api_1.ARandom {
export class SystemRandom extends ARandom {
int() {

@@ -13,3 +11,2 @@ return (random() * 0xffffffff) >>> 0;

}
exports.SystemRandom = SystemRandom;
exports.SYSTEM = new SystemRandom();
export const SYSTEM = new SystemRandom();

@@ -1,2 +0,2 @@

import { IBuffered, ICopy } from "@thi.ng/api/api";
import { IBuffered, ICopy } from "@thi.ng/api";
import { ARandom, ISeedable } from "./api";

@@ -3,0 +3,0 @@ export declare class XorShift128 extends ARandom implements IBuffered<Uint32Array>, ICopy<XorShift128>, ISeedable<ArrayLike<number>> {

@@ -1,7 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const api_1 = require("./api");
import { ARandom } from "./api";
// https://en.wikipedia.org/wiki/Xorshift
const DEFAULT_SEED = [0xdecafbad, 0x2fa9d75b, 0xe41f67e3, 0x5c83ec1a];
class XorShift128 extends api_1.ARandom {
export class XorShift128 extends ARandom {
constructor(seed = DEFAULT_SEED) {

@@ -34,2 +32,1 @@ super();

}
exports.XorShift128 = XorShift128;

@@ -1,2 +0,2 @@

import { IBuffered, ICopy } from "@thi.ng/api/api";
import { IBuffered, ICopy } from "@thi.ng/api";
import { ARandom, ISeedable } from "./api";

@@ -3,0 +3,0 @@ export declare class XorWow extends ARandom implements IBuffered<Uint32Array>, ICopy<XorWow>, ISeedable<ArrayLike<number>> {

@@ -1,7 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const api_1 = require("./api");
import { ARandom } from "./api";
// https://en.wikipedia.org/wiki/Xorshift#xorwow
const DEFAULT_SEED = [0xdecafbad, 0x2fa9d75b, 0xe41f67e3, 0x5c83ec1a, 0xf69a5c71];
class XorWow extends api_1.ARandom {
export class XorWow extends ARandom {
constructor(seed = DEFAULT_SEED) {

@@ -37,2 +35,1 @@ super();

}
exports.XorWow = XorWow;

@@ -1,2 +0,2 @@

import { IBuffered, ICopy } from "@thi.ng/api/api";
import { IBuffered, ICopy } from "@thi.ng/api";
import { ARandom, ISeedable } from "./api";

@@ -3,0 +3,0 @@ export declare class XsAdd extends ARandom implements IBuffered<Uint32Array>, ICopy<XsAdd>, ISeedable<number> {

@@ -1,7 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const api_1 = require("./api");
import { ARandom } from "./api";
// https://github.com/MersenneTwister-Lab/XSadd/blob/master/xsadd.h
const DEFAULT_SEED = 0xdecafbad;
class XsAdd extends api_1.ARandom {
export class XsAdd extends ARandom {
constructor(seed = DEFAULT_SEED) {

@@ -43,2 +41,1 @@ super();

}
exports.XsAdd = XsAdd;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc