diff options
author | anonymous | 2022-09-21 12:46:08 -0400 |
---|---|---|
committer | anonymous | 2022-09-21 12:46:08 -0400 |
commit | 0b6af85a818fa3c2a8dd8d78ccc29aa099dc40e8 (patch) | |
tree | efe2d8e847f9f59b1ccec8092c2c08c413874d21 | |
parent | 16cbe07449420b94d6121de96f27c02ca5d1bec8 (diff) |
anonymized and biased logoot
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | logoot.js | 13 |
2 files changed, 12 insertions, 7 deletions
@@ -1,12 +1,12 @@ # Graffiti for Vanilla Javascript -This is the base Javascript library that interfaces with the [Graffiti server](https://github.com/csail-graffiti/server). -We recommend not using this vanilla library itself but instead using framework plugins that are built on top of it like the [Graffiti plugin for Vue.JS](https://github.com/csail-graffiti/graffiti-x-vue). +This is the base Javascript library that interfaces with the [Graffiti server](https://github.com/digital-graffiti/server). +We recommend not using this vanilla library itself but instead using framework plugins that are built on top of it like the [Graffiti plugin for Vue.JS](https://github.com/digital-graffiti/graffiti-x-vue). Example usage: ```javascript -import Graffiti from "https://csail-graffiti.github.io/graffiti-x-js/graffiti.js" +import Graffiti from "https://digital-graffiti.github.io/graffiti-x-js/graffiti.js" // You can initialize a connection to the graffiti server const graffiti = Graffiti() @@ -21,7 +21,7 @@ export default { return [this.maxInt+1] }, - between(a, b) { + between(a, b, scale=100) { // Strip zeros and find common length const aLength = this.lengthWithoutZeros(a) const bLength = this.lengthWithoutZeros(b) @@ -103,9 +103,14 @@ export default { } } - // Finally, sample between the upper and - // lower bounds - out.push(Math.floor(Math.random() * (upperBound + 1 - lowerBound)) + lowerBound) + // Create a random number in [0,1] but bias it to be small, + // so that numbers tend to increase by a small amount. + let random = Math.random() + random = -Math.log(1-random)/scale + random = Math.min(random, 1) + + // Finally, sample between the upper and lower bounds + out.push(Math.floor(random * (upperBound + 1 - lowerBound)) + lowerBound) return out }, |