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){
2
2
// build script for generating processing.js
3
3
4
4
var Browser = {
@@ -25,7 +25,7 @@ window.Processing = require('./src/')(Browser);
25
25
},{"./src/":27}],2:[function(require,module,exports){
26
26
module.exports={
27
27
"name": "Processing.js",
28
- "version": "1.4.7 ",
28
+ "version": "1.4.8 ",
29
29
"dependencies": {
30
30
"argv": "~0.0.2",
31
31
"browserify": "~2.18.1",
@@ -6869,6 +6869,7 @@ module.exports = function withMath(p, undef) {
6869
6869
};
6870
6870
this.intGenerator = intGenerator;
6871
6871
}
6872
+
6872
6873
Marsaglia.createRandomized = function() {
6873
6874
var now = new Date();
6874
6875
return new Marsaglia((now / 60000) & 0xFFFFFFFF, now & 0xFFFFFFFF);
@@ -6887,35 +6888,39 @@ module.exports = function withMath(p, undef) {
6887
6888
*/
6888
6889
p.randomSeed = function(seed) {
6889
6890
internalRandomGenerator = (new Marsaglia(seed)).doubleGenerator;
6891
+ this.haveNextNextGaussian = false;
6890
6892
};
6891
6893
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);
6913
6918
6914
- return v1 * multiplier;
6915
- };
6919
+ var multiplier = Math.sqrt(-2 * Math.log(s) / s);
6920
+ this.nextNextGaussian = v2 * multiplier;
6921
+ this.haveNextNextGaussian = true;
6916
6922
6917
- // by default use standard random, otherwise seeded
6918
- random = (seed === undef) ? Math.random : (new Marsaglia(seed)).doubleGenerator;
6923
+ return v1 * multiplier;
6919
6924
};
6920
6925
6921
6926
// Noise functions and helpers
@@ -7691,7 +7696,7 @@ module.exports = function setupParser(Processing, options) {
7691
7696
"PMatrix3D", "PMatrixStack", "pmouseX", "pmouseY", "point",
7692
7697
"pointLight", "popMatrix", "popStyle", "pow", "print", "printCamera",
7693
7698
"println", "printMatrix", "printProjection", "PShape", "PShapeSVG",
7694
- "pushMatrix", "pushStyle", "quad", "radians", "random", "Random ",
7699
+ "pushMatrix", "pushStyle", "quad", "radians", "random", "randomGaussian ",
7695
7700
"randomSeed", "rect", "rectMode", "red", "redraw", "requestImage",
7696
7701
"resetMatrix", "reverse", "rotate", "rotateX", "rotateY", "rotateZ",
7697
7702
"round", "saturation", "save", "saveFrame", "saveStrings", "scale",
@@ -21636,4 +21641,5 @@ module.exports = function buildProcessingJS(Browser, testHarness) {
21636
21641
return Processing;
21637
21642
};
21638
21643
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