diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e63256..7174017 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. +## [2.1.1](https://github.com/pex-gl/pex-random/compare/v2.1.0...v2.1.1) (2024-07-09) + + + # [2.1.0](https://github.com/pex-gl/pex-random/compare/v2.0.0...v2.1.0) (2024-04-12) diff --git a/README.md b/README.md index c055071..e4b257e 100755 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Notes: ## Classes
-
Random
+
pex-random
@@ -71,6 +71,12 @@ Notes:
FBMOptions
+
vec2 : module:pex-math~vec2
+
+
vec3 : module:pex-math~vec3
+
+
quat : module:pex-math~quat
+
@@ -83,31 +89,31 @@ Notes: - Call `random.seed("seed")` to overwrite the global PRNG: all other calls to `random.float()` will derive from the new seeded state. - Call `random.create()` to create a local instance of Random with a separate unpredictable PRNG. - Call `random.create("seed")` to create a local instance of Random with a separate predictable PRNG: all other calls to `random.float()` will derive from the new seeded state. - + -## Random +## pex-random **Kind**: global class -- [Random](#Random) - - [new Random([seed])](#new_Random_new) - - [.create](#Random+create) ⇒ [Random](#Random) - - [.seed(s)](#Random+seed) - - [.float([min], [max])](#Random+float) ⇒ number - - [.int([min], [max])](#Random+int) ⇒ number - - [.vec2([r])](#Random+vec2) ⇒ module:pex-math~vec2 - - [.vec3([r])](#Random+vec3) ⇒ module:pex-math~vec3 - - [.vec2InRect(rect)](#Random+vec2InRect) ⇒ module:pex-math~vec2 - - [.vec3InAABB(bbox)](#Random+vec3InAABB) ⇒ module:pex-math~vec3 - - [.quat()](#Random+quat) ⇒ module:pex-math~quat - - [.chance([probability])](#Random+chance) ⇒ boolean - - [.element(list)](#Random+element) ⇒ \* - - [.noise2(x, y)](#Random+noise2) ⇒ number - - [.noise3(x, y, z)](#Random+noise3) ⇒ number - - [.noise4(x, y, z, w)](#Random+noise4) ⇒ number - - [.fbm(options, ...d)](#Random+fbm) ⇒ number - - +- [pex-random](#pex-random) + - [new Random([seed])](#new_pex-random_new) + - [.create](#pex-random+create) ⇒ Random + - [.seed(s)](#pex-random+seed) + - [.float([min], [max])](#pex-random+float) ⇒ number + - [.int([min], [max])](#pex-random+int) ⇒ number + - [.vec2([r])](#pex-random+vec2) ⇒ [vec2](#vec2) + - [.vec3([r])](#pex-random+vec3) ⇒ [vec3](#vec3) + - [.vec2InRect(rect)](#pex-random+vec2InRect) ⇒ [vec2](#vec2) + - [.vec3InAABB(bbox)](#pex-random+vec3InAABB) ⇒ [vec3](#vec3) + - [.quat()](#pex-random+quat) ⇒ [quat](#quat) + - [.chance([probability])](#pex-random+chance) ⇒ boolean + - [.element(list)](#pex-random+element) ⇒ \* + - [.noise2(x, y)](#pex-random+noise2) ⇒ number + - [.noise3(x, y, z)](#pex-random+noise3) ⇒ number + - [.noise4(x, y, z, w)](#pex-random+noise4) ⇒ number + - [.fbm(options, ...d)](#pex-random+fbm) ⇒ number + + ### new Random([seed]) @@ -117,153 +123,153 @@ Creates an instance of Random. | ------ | ------------------------------------------ | ----------------------------------------------------------- | | [seed] | string \| number | "Random.NOW + Random.#instanceCount" | - + -### random.create ⇒ [Random](#Random) +### pex-random.create ⇒ Random Create an instance of Random. -**Kind**: instance property of [Random](#Random) +**Kind**: instance property of [pex-random](#pex-random) | Param | Type | Description | | ------ | ------------------------------------------ | ---------------------------------------------------------------------------------- | | [seed] | string \| number | If omitted, the global PRNG seed will be used and incremented for each local PRNG. | - + -### random.seed(s) +### pex-random.seed(s) Set the seed for the random number generator. -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) | Param | Type | Description | | ----- | ------------------- | ----------- | | s | string | Seed value | - + -### random.float([min], [max]) ⇒ number +### pex-random.float([min], [max]) ⇒ number Get a float between min and max. Defaults to: - `0 <= x < 1` if no argument supplied - `0 <= x < max` if only one argument supplied -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) | Param | Type | | ----- | ------------------- | | [min] | number | | [max] | number | - + -### random.int([min], [max]) ⇒ number +### pex-random.int([min], [max]) ⇒ number Get an int between min and max. Defaults to: - `0 <= x < Number.MAX_SAFE_INTEGER` if no argument supplied - `0 <= x < max` if only one argument supplied -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) | Param | Type | | ----- | ------------------- | | [min] | number | | [max] | number | - + -### random.vec2([r]) ⇒ module:pex-math~vec2 +### pex-random.vec2([r]) ⇒ [vec2](#vec2) Get a vec2 included in a radius. -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) | Param | Type | Default | Description | | ----- | ------------------- | -------------- | ----------- | | [r] | number | 1 | radius | - + -### random.vec3([r]) ⇒ module:pex-math~vec3 +### pex-random.vec3([r]) ⇒ [vec3](#vec3) Get a vec3 included in a radius. -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) | Param | Type | Default | Description | | ----- | ------------------- | -------------- | ----------- | | [r] | number | 1 | radius | - + -### random.vec2InRect(rect) ⇒ module:pex-math~vec2 +### pex-random.vec2InRect(rect) ⇒ [vec2](#vec2) Get a vec2 included in a rectangle. -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) | Param | Type | Description | | ----- | ------------------- | ----------- | | rect | number | rectangle | - + -### random.vec3InAABB(bbox) ⇒ module:pex-math~vec3 +### pex-random.vec3InAABB(bbox) ⇒ [vec3](#vec3) Get a vec3 included in a rectangle bbox. -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) | Param | Type | Description | | ----- | ------------------- | -------------- | | bbox | number | rectangle bbox | - + -### random.quat() ⇒ module:pex-math~quat +### pex-random.quat() ⇒ [quat](#quat) Get a random quaternion. -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) **See** - [Graphics Gems III, Edited by David Kirk, III.6 UNIFORM RANDOM ROTATIONS] - [Steve LaValle](https://web.archive.org/web/20211105205926/http://planning.cs.uiuc.edu/node198.html) - + -### random.chance([probability]) ⇒ boolean +### pex-random.chance([probability]) ⇒ boolean Returns a chance of an event occuring according to a given probability between 0 and 1. -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) | Param | Type | Default | Description | | ------------- | ------------------- | ---------------- | ---------------------- | | [probability] | number | 0.5 | Float between 0 and 1. | - + -### random.element(list) ⇒ \* +### pex-random.element(list) ⇒ \* Gets a random element from a list. -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) | Param | Type | | ----- | ------------------ | | list | Array | - + -### random.noise2(x, y) ⇒ number +### pex-random.noise2(x, y) ⇒ number Samples the noise field in 2 dimensions. -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) **Returns**: number - in the interval [-1, 1] | Param | Type | @@ -271,13 +277,13 @@ Samples the noise field in 2 dimensions. | x | number | | y | number | - + -### random.noise3(x, y, z) ⇒ number +### pex-random.noise3(x, y, z) ⇒ number Samples the noise field in 3 dimensions. -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) **Returns**: number - in the interval [-1, 1] | Param | Type | @@ -286,13 +292,13 @@ Samples the noise field in 3 dimensions. | y | number | | z | number | - + -### random.noise4(x, y, z, w) ⇒ number +### pex-random.noise4(x, y, z, w) ⇒ number Samples the noise field in 4 dimensions. -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) **Returns**: number - in the interval [-1, 1] | Param | Type | @@ -302,13 +308,13 @@ Samples the noise field in 4 dimensions. | z | number | | w | number | - + -### random.fbm(options, ...d) ⇒ number +### pex-random.fbm(options, ...d) ⇒ number Fractional Brownian motion (also called fractal Brownian motion) noise. Default to 1/f noise with 8 octaves. -**Kind**: instance method of [Random](#Random) +**Kind**: instance method of [pex-random](#pex-random) **Returns**: number - in the interval [-1, 1] | Param | Type | Description | @@ -332,6 +338,22 @@ Fractional Brownian motion (also called fractal Brownian motion) noise. Default | [amplitude] | number | gain | | [noise] | function | | + + +## vec2 : module:pex-math~vec2 + +**Kind**: global typedef + + +## vec3 : module:pex-math~vec3 + +**Kind**: global typedef + + +## quat : module:pex-math~quat + +**Kind**: global typedef + ## License diff --git a/package-lock.json b/package-lock.json index ffc2005..72af707 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pex-random", - "version": "2.1.0", + "version": "2.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pex-random", - "version": "2.1.0", + "version": "2.1.1", "license": "MIT", "dependencies": { "seedrandom": "^3.0.5", diff --git a/package.json b/package.json index fa9c5a3..d89e5e5 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pex-random", - "version": "2.1.0", + "version": "2.1.1", "description": "Random value generators (float, int, vector and noise) for PEX.", "keywords": [ "pex", @@ -14,7 +14,10 @@ ], "homepage": "https://github.com/pex-gl/pex-random", "bugs": "https://github.com/pex-gl/pex-random/issues", - "repository": "pex-gl/pex-random", + "repository": { + "type": "git", + "url": "git+https://github.com/pex-gl/pex-random.git" + }, "license": "MIT", "author": "Marcin Ignac (http://marcinignac.com)", "contributors": [