Permalink
Browse files

Some light exorcising

  • Loading branch information...
dreeves committed Sep 2, 2018
1 parent 477c2c6 commit 7bdb078476ad550ccdec7be3d35a308fa86e140a
Showing with 28 additions and 18 deletions.
  1. +2 −2 script/tagtime.rb
  2. +3 −2 settings.pl.template
  3. +2 −2 src/and/tagTime/src/main/java/bsoule/tagtime/PingService.java
  4. +21 −12 util.pl
View
@@ -8,7 +8,7 @@
# $seed is a global variable that is really the state of the RNG.
$gap = 45*60
$seed = 666
$seed = 11193462
$initseed = $seed
# Returns a random integer in [1,$IM-1]; changes $seed, ie, RNG state.
@@ -41,7 +41,7 @@ def prevping(t)
$seed = $initseed;
# Starting at the beginning of time, walk forward computing next pings
# until the next ping is >= t.
nxtping = 1184083200 # the birth of timepie/tagtime!
nxtping = 1184097393 # the birth of timepie/tagtime!
lstping = nxtping
lstseed = $seed
while nxtping < t
View
@@ -44,9 +44,10 @@ $beemauth = "abc123"; # CHANGEME to your personal beeminder auth token
# tag "off" is also added.)
$retrothresh = 60;
# If you want the universal ping schedule, don't touch these 3 settings...
$gap = 45*60; # Average number of seconds between pings (eg, 60*60 = 1 hour).
$seed = 666; # For pings not in sync with others, change this (NB: > 0).
$URPING = 1184097393; # Ur-ping, ie, the birth of timepie/tagtime! (unixtime)
$seed = 11193462;
$linelen = 79; # Try to keep log lines at most this long.
@@ -226,7 +226,7 @@ private void setAlarm(long PING) {
private static final long IA = 16807;
private static final long IM = 2147483647;
private static final long INITSEED = 666;
private static final long INITSEED = 11193462;
/* *********************** *
* Random number generator * ***********************
@@ -266,7 +266,7 @@ public static long prevping(long t, int gap) {
// Starting at the beginning of time, walk forward computing next pings
// until the next ping is >= t.
final int TUES = 1261198800; // some random time more recent than that..
final int BOT = 1184083200; // start at the birth of timepie!
final int BOT = 1184097393; // start at the birth of timepie!
long nxt = TPController.DEBUG ? TUES : BOT;
long lst = nxt;
long lstseed = SEED;
View
33 util.pl
@@ -10,23 +10,32 @@
my $IA = 16807; # constant used for RNG (see p37 of Simulation by Ross)
my $IM = 2147483647; # constant used for RNG (2^31-1)
my $URPING = 1184083200; # ur-ping, ie, the birth of timepie/tagtime! (unixtime)
# Alternative ur-pings and initial seeds that yield the exact same universal
# ping schedule:
# seed=85333798, urping=5843 (~1970) # By choosing a non-random
# seed=8992, urping=1035903364 (~2002) # initial seed of 666 in 2007 we
# seed=1210011908, urping=1184042737 (~2007) # slightly messed up the
# seed=666, urping=1184083200 (~2007) # distribution (ie, there's an
# seed=11193462, urping=1184097393 (~2007) # improbably long max gap) iff
# seed=85014, urping=1234180122 (~2009) # you use an ur-ping before
# seed=26506, urping=1443641796 (~2015) # 1184083200.
if(!defined($URPING)) {
# The original URPING, SEED from 2007 was 1184083200, 666 which caused
# offense -- http://forum.beeminder.com/t/2004/15 -- so I agreed to change it.
# Then I realized that it's bad if anyone doing a git pull has the ping
# schedule change on them so I'm adding the following hack to force-change the
# seed from the offending one. But this only happens if you have seed but no
# ur-ping specified. The settings file now expects both and if you specify
# both you can set them to whatever you want. So hopefully everyone is happy
# this way!
if($seed == 666) { $seed = 11193462; }
# Once the old seed is a distant memory we can get rid of the above altogether
# and only have the new URPING, SEED = 1184097393, 11193462
$URPING = 1184097393;
}
# $seed is a global variable that is really the state of the RNG.
# Should be set in .tagtimerc but set to a default value here if not.
if(!defined($seed)) { $seed = 666; }
if(!defined($seed)) { $seed = 11193462; }
my $initseed = $seed;
# Above URPING is n 2007 and it's fine to jump to any later URPING/SEED pair
# like this one in 2018:
# URPING = 1532992625
# SEED = 75570
if(!defined($linelen)) { $linelen = 80; } # default line length.
# Returns a random integer in [1,$IM-1]; changes $seed, ie, RNG state.

0 comments on commit 7bdb078

Please sign in to comment.