+Using the van der Corput sequences for bases 2,3 we can generate a sequence of
+quasirandom points in the unit square. The sequence is said to be
+
low-discrepancy
+(basically the points are somewhat more uniformly spread across the square; you
+would expect a truly random sequence of points to have some concentrated lumps
+and small areas with no points).
+
+quasi-Monte Carlo methods generally have better error properties compared to the
+standard random and pseudo-random MC methods. As a demonstration, we will
+estimate π by sampling points in the unit square. The left side shows the
+VDC estimate using bases 2 (x) and 3 (y). The right side shows the random
+estimate by repeatedly calling Math.random.
+
+The graphs show the results of sampling many points and estimating PI. Below
+the graphs, the PI value shows the calculated estimate, "err %" shows the
+relative error (smaller is better) and "ln err" shows the natural log of the
+error (smaller is better).
+
+VDC sequences can be "seeded" by setting the starting index for the calculation.
+In this demo a random integer is chosen using Math.random.
+
+The values and graphs are calculated in your browser window. If the graphs do
+not appear or the values are not calculated, please report the issue!
+
+
+
+
VDC (2,3) Sampling
+
+
+
+ Estimate of PI:
+
+
+
Math.random Sampling
+
+
+
+ Estimate of PI:
+
+
+
+
+
+
+
+
+
diff --git a/misc/help.sh b/misc/help.sh
new file mode 100755
index 0000000..7a1c4c4
--- /dev/null
+++ b/misc/help.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+# make_help.sh -- process listing of targets and special items in Makefile
+# Copyright (C) 2016-present SheetJS
+#
+# usage in makefile: pipe the output of the following command:
+# @grep -hE '(^[a-zA-Z_-][ a-zA-Z_-]*:.*?|^#[#*])' $(MAKEFILE_LIST)
+#
+# lines starting with "## " are treated as subtitles
+# lines starting with "#* " are treated as plaintext comments
+# multiple targets with "## " after the ":" are rendered as separate targets
+# if the presumed default target is labeled, it will be assigned a unique color
+
+awk '
+BEGIN{recipes=0;}
+ !/#[#*] .*$/ {next;}
+ {multi=0; isrecipe=0;}
+ /^[^#]*:/ {isrecipe=1; ++recipes;}
+ /^[^ :]* .*:/ {multi=1}
+ multi==0 && isrecipe>0 { if(recipes > 1) print; else print $0, "[default]"; next}
+ isrecipe == 0 {print; next}
+ multi>0 {
+ k=split($0, msg, "##"); m=split($0, a, ":"); n=split(a[1], b, " ");
+ for(i=1; i<=n; ++i) print b[i] ":", "##" msg[2], (recipes==1 && i==1 ? "[default]" : "")
+ }
+END {}
+' | if [[ -t 1 ]]; then
+awk '
+BEGIN {FS = ":.*?## "}
+ {color=36}
+ /\[default\]/ {color=35}
+ NF==1 && /^##/ {color=34}
+ NF==1 && /^#\*/ {color=20; $1 = substr($1, 4)}
+ {printf "\033[" color "m%-20s\033[0m %s\n", $1, $2;}
+END{}' -
+else
+awk '
+BEGIN {FS = ":.*?## "}
+ /^#\* / {$1 = substr($1, 4)}
+ {printf "%-20s %s\n", $1, $2;}
+END{}' -
+fi
+
diff --git a/misc/spin.sh b/misc/spin.sh
new file mode 100755
index 0000000..471dfee
--- /dev/null
+++ b/misc/spin.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# spin.sh -- show a spinner (for coverage test)
+# Copyright (C) 2014-present SheetJS
+
+wpid=$1
+delay=1
+str="|/-\\"
+while [ $(ps -a|awk '$1=='$wpid' {print $1}') ]; do
+ t=${str#?}
+ printf " [%c]" "$str"
+ str=$t${str%"$t"}
+ sleep $delay
+ printf "\b\b\b\b"
+done
diff --git a/package.json b/package.json
index b252f3c..340fe8b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "vdc",
- "version": "0.2.0",
+ "version": "0.2.1",
"author": "SheetJS",
"description": "van der Corput low-discrepancy sequences",
"keywords": [ "math", "random", "qrng", "lds" ],
@@ -19,6 +19,11 @@
"scripts": {
"test": "make test"
},
+ "config": {
+ "blanket": {
+ "pattern": "vdc.js"
+ }
+ },
"bugs": { "url": "https://github.com/SheetJS/js-vdc/issues" },
"license": "Apache-2.0",
"engines": { "node": ">=0.8" }