summaryrefslogtreecommitdiff
path: root/proper-random/javascript/prng4.js
diff options
context:
space:
mode:
authorausiv4 <ausiv4@eb105b4a-77de-11de-a249-6bf219df57d5>2009-07-24 13:58:33 +0000
committerausiv4 <ausiv4@eb105b4a-77de-11de-a249-6bf219df57d5>2009-07-24 13:58:33 +0000
commit8d359f4d8e27bf5992508bc11486a482d270d6f8 (patch)
tree497a31578ce8443125347504787e9b5889d7117b /proper-random/javascript/prng4.js
parent40fd75696b548d18057a289e849be98dd2af12dd (diff)
Fixing previous mistake
Diffstat (limited to 'proper-random/javascript/prng4.js')
-rw-r--r--proper-random/javascript/prng4.js45
1 files changed, 0 insertions, 45 deletions
diff --git a/proper-random/javascript/prng4.js b/proper-random/javascript/prng4.js
deleted file mode 100644
index 3034f3f..0000000
--- a/proper-random/javascript/prng4.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// prng4.js - uses Arcfour as a PRNG
-
-function Arcfour() {
- this.i = 0;
- this.j = 0;
- this.S = new Array();
-}
-
-// Initialize arcfour context from key, an array of ints, each from [0..255]
-function ARC4init(key) {
- var i, j, t;
- for(i = 0; i < 256; ++i)
- this.S[i] = i;
- j = 0;
- for(i = 0; i < 256; ++i) {
- j = (j + this.S[i] + key[i % key.length]) & 255;
- t = this.S[i];
- this.S[i] = this.S[j];
- this.S[j] = t;
- }
- this.i = 0;
- this.j = 0;
-}
-
-function ARC4next() {
- var t;
- this.i = (this.i + 1) & 255;
- this.j = (this.j + this.S[this.i]) & 255;
- t = this.S[this.i];
- this.S[this.i] = this.S[this.j];
- this.S[this.j] = t;
- return this.S[(t + this.S[this.i]) & 255];
-}
-
-Arcfour.prototype.init = ARC4init;
-Arcfour.prototype.next = ARC4next;
-
-// Plug in your RNG constructor here
-function prng_newstate() {
- return new Arcfour();
-}
-
-// Pool size must be a multiple of 4 and greater than 32.
-// An array of bytes the size of the pool will be passed to init()
-var rng_psize = 256;