Skip to content

Commit 1132da1

Browse files
committed
pre-1.4.8 commit
1 parent 61026ac commit 1132da1

File tree

4 files changed

+435
-429
lines changed

4 files changed

+435
-429
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Processing.js",
3-
"version": "1.4.7",
3+
"version": "1.4.8",
44
"main": "processing.js",
55
"ignore": [
66
"bundle",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Processing.js",
3-
"version": "1.4.7",
3+
"version": "1.4.8",
44
"dependencies": {
55
"argv": "~0.0.2",
66
"browserify": "~2.18.1",

processing.js

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
1+
;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
22
// build script for generating processing.js
33

44
var Browser = {
@@ -25,7 +25,7 @@ window.Processing = require('./src/')(Browser);
2525
},{"./src/":27}],2:[function(require,module,exports){
2626
module.exports={
2727
"name": "Processing.js",
28-
"version": "1.4.7",
28+
"version": "1.4.8",
2929
"dependencies": {
3030
"argv": "~0.0.2",
3131
"browserify": "~2.18.1",
@@ -6869,6 +6869,7 @@ module.exports = function withMath(p, undef) {
68696869
};
68706870
this.intGenerator = intGenerator;
68716871
}
6872+
68726873
Marsaglia.createRandomized = function() {
68736874
var now = new Date();
68746875
return new Marsaglia((now / 60000) & 0xFFFFFFFF, now & 0xFFFFFFFF);
@@ -6887,35 +6888,39 @@ module.exports = function withMath(p, undef) {
68876888
*/
68886889
p.randomSeed = function(seed) {
68896890
internalRandomGenerator = (new Marsaglia(seed)).doubleGenerator;
6891+
this.haveNextNextGaussian = false;
68906892
};
68916893

6892-
// Random
6893-
// We have two random()'s in the code... what does this do ? and which one is current ?
6894-
p.Random = function(seed) {
6895-
var haveNextNextGaussian = false, nextNextGaussian, random;
6896-
6897-
this.nextGaussian = function() {
6898-
if (haveNextNextGaussian) {
6899-
haveNextNextGaussian = false;
6900-
return nextNextGaussian;
6901-
}
6902-
var v1, v2, s;
6903-
do {
6904-
v1 = 2 * random() - 1; // between -1.0 and 1.0
6905-
v2 = 2 * random() - 1; // between -1.0 and 1.0
6906-
s = v1 * v1 + v2 * v2;
6907-
}
6908-
while (s >= 1 || s === 0);
6909-
6910-
var multiplier = Math.sqrt(-2 * Math.log(s) / s);
6911-
nextNextGaussian = v2 * multiplier;
6912-
haveNextNextGaussian = true;
6894+
/**
6895+
* Returns a float from a random series of numbers having a mean of 0 and standard deviation of 1. Each time
6896+
* the randomGaussian() function is called, it returns a number fitting a Gaussian, or normal, distribution.
6897+
* There is theoretically no minimum or maximum value that randomGaussian() might return. Rather, there is just a
6898+
* very low probability that values far from the mean will be returned; and a higher probability that numbers
6899+
* near the mean will be returned.
6900+
*
6901+
* @returns {float}
6902+
*
6903+
* @see random
6904+
* @see noise
6905+
*/
6906+
p.randomGaussian = function() {
6907+
if (this.haveNextNextGaussian) {
6908+
this.haveNextNextGaussian = false;
6909+
return this.nextNextGaussian;
6910+
}
6911+
var v1, v2, s;
6912+
do {
6913+
v1 = 2 * internalRandomGenerator() - 1; // between -1.0 and 1.0
6914+
v2 = 2 * internalRandomGenerator() - 1; // between -1.0 and 1.0
6915+
s = v1 * v1 + v2 * v2;
6916+
}
6917+
while (s >= 1 || s === 0);
69136918

6914-
return v1 * multiplier;
6915-
};
6919+
var multiplier = Math.sqrt(-2 * Math.log(s) / s);
6920+
this.nextNextGaussian = v2 * multiplier;
6921+
this.haveNextNextGaussian = true;
69166922

6917-
// by default use standard random, otherwise seeded
6918-
random = (seed === undef) ? Math.random : (new Marsaglia(seed)).doubleGenerator;
6923+
return v1 * multiplier;
69196924
};
69206925

69216926
// Noise functions and helpers
@@ -7691,7 +7696,7 @@ module.exports = function setupParser(Processing, options) {
76917696
"PMatrix3D", "PMatrixStack", "pmouseX", "pmouseY", "point",
76927697
"pointLight", "popMatrix", "popStyle", "pow", "print", "printCamera",
76937698
"println", "printMatrix", "printProjection", "PShape", "PShapeSVG",
7694-
"pushMatrix", "pushStyle", "quad", "radians", "random", "Random",
7699+
"pushMatrix", "pushStyle", "quad", "radians", "random", "randomGaussian",
76957700
"randomSeed", "rect", "rectMode", "red", "redraw", "requestImage",
76967701
"resetMatrix", "reverse", "rotate", "rotateX", "rotateY", "rotateZ",
76977702
"round", "saturation", "save", "saveFrame", "saveStrings", "scale",
@@ -21636,4 +21641,5 @@ module.exports = function buildProcessingJS(Browser, testHarness) {
2163621641
return Processing;
2163721642
};
2163821643

21639-
},{"../package.json":2,"./Helpers/ObjectIterator":3,"./Helpers/PConstants":4,"./Helpers/defaultScope":5,"./Helpers/finalizeProcessing":6,"./Helpers/virtEquals":7,"./Helpers/virtHashCode":8,"./Objects/ArrayList":9,"./Objects/Char":10,"./Objects/HashMap":11,"./Objects/PFont":12,"./Objects/PMatrix2D":13,"./Objects/PMatrix3D":14,"./Objects/PShape":15,"./Objects/PShapeSVG":16,"./Objects/PVector":17,"./Objects/XMLAttribute":18,"./Objects/XMLElement":19,"./Objects/webcolors":20,"./P5Functions/JavaProxyFunctions":21,"./P5Functions/Math.js":22,"./P5Functions/commonFunctions":23,"./P5Functions/touchmouse":24,"./Parser/Parser":25,"./Processing":26}]},{},[1])
21644+
},{"../package.json":2,"./Helpers/ObjectIterator":3,"./Helpers/PConstants":4,"./Helpers/defaultScope":5,"./Helpers/finalizeProcessing":6,"./Helpers/virtEquals":7,"./Helpers/virtHashCode":8,"./Objects/ArrayList":9,"./Objects/Char":10,"./Objects/HashMap":11,"./Objects/PFont":12,"./Objects/PMatrix2D":13,"./Objects/PMatrix3D":14,"./Objects/PShape":15,"./Objects/PShapeSVG":16,"./Objects/PVector":17,"./Objects/XMLAttribute":18,"./Objects/XMLElement":19,"./Objects/webcolors":20,"./P5Functions/JavaProxyFunctions":21,"./P5Functions/Math.js":22,"./P5Functions/commonFunctions":23,"./P5Functions/touchmouse":24,"./Parser/Parser":25,"./Processing":26}]},{},[1])
21645+
;

0 commit comments

Comments
 (0)