From: Tom Pollard Date: 2006-11-01T22:56:27+09:00 Subject: Re: Fuzzy Time (#99) On Nov 1, 2006, at 5:08 AM, Paolo Negri wrote: > I choose my offset through a dedicated class (WanderingWalker) that > works always in seconds. > Basicly I start from the current offset (or position) and I genereta a > target to reach (by default a random number between -300 + 300) after > that I begin moving my offset of 1 unit per every consumed second in > the direction of the target. So in one second my offset moves of +/- 1 > second, in one minute moves of +/- 60 seconds and so on. > When I reach the given target offset I just generate another target > to reach. > I choosed this approach because it forces the clock to reach smoothly > any generated target at any update rate, and, in theory, moving the > offset this way is possible to avoid the check against going back with > the time. That's interesting. The insight I had, after trying my first two methods, was that to get the distribution to be balanced, the distribution for each random change had to be balanced as well. However, since you can't reduce the offset arbitrarily without worrying that the clock will regress, you need to restrict positive changes in the offset to be no greater than the greatest negative offset you can choose. Because your method adjusts the offset gradually to reach a randomly chosen target, you can choose the target freely from [-5..5] (minutes), whereas I'm restricted to [-1..1]. You end up with Gaussian-like distribution, rather than a flat distribution, because the steps you take between targets end up being part of the distribution as well. Unlike yours, my method (as currently implemented) only works as intended when the time is updated once a minute. I should really be adjusting the range over which the offset is selected based on the step size. Your method works equally well regardless of the step size. Tom