commit a4cb8608da2651b386d7c8539ffedbe803991f07
parent 85b703aa33f48de16297a648c36faf1719590053
Author: Simon Kornblith <simon@simonster.com>
Date: Sun, 24 Oct 2010 23:55:50 +0000
remove ZU.probability
Diffstat:
3 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/chrome/content/zotero/xpcom/debug.js b/chrome/content/zotero/xpcom/debug.js
@@ -80,7 +80,7 @@ Zotero.Debug = new function () {
dump('zotero(' + level + ')' + (_time ? deltaStr : '') + ': ' + message + "\n\n");
}
if (_store) {
- if (Zotero.Utilities.prototype.probability(1000)) {
+ if (Math.random() < 1/1000) {
// Remove initial lines if over limit
var overage = this.count() - Zotero.Prefs.get('debug.store.limit');
if (overage > 0) {
diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js
@@ -407,19 +407,6 @@ Zotero.Utilities.prototype.rand = function (min, max) {
/**
- * Return true according to a given probability
- *
- * @param {Integer} x Will return true every x times on average
- * @return {Boolean} On average, TRUE every x times
- * the function is called
- */
-Zotero.Utilities.prototype.probability = function (x) {
- return this.rand(1, x) == this.rand(1, x);
-}
-
-
-
-/**
* Determine the necessary data type for SQLite parameter binding
*
* @return int 0 for string, 32 for int32, 64 for int64
diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js
@@ -1377,7 +1377,7 @@ var Zotero = new function(){
// DEBUG: this might not need to be permanent
Zotero.Relations.purge();
- if (!skipStoragePurge && Zotero.Utilities.prototype.probability(10)) {
+ if (!skipStoragePurge && Math.random() < 1/10) {
Zotero.Sync.Storage.purgeDeletedStorageFiles('zfs');
Zotero.Sync.Storage.purgeDeletedStorageFiles('webdav');
}