If you don't mind it involving a small background processing overhead, you 
could use a goroutine running a hashcash style iterative hash chain 
generation searching for a specified number of zero bits at one (or both) 
ends of the resultant hash before you run out of bits. This is extremely 
random when started from a proper random seed and you would have the 
process send a signal through a channel to trigger the ticker.

It wouldn't have to be that intensive a search, you could for example run 
the search itself on a regular ticker like every 100ms to drop the 
processing load, but within a fairly wide margin it will be quite random.

On Tuesday, 25 September 2018 11:34:14 UTC+2, David Wahlstedt wrote:
>
> Hi,
> What would be a nice way to implement a ticker that generates events 
> according to a Poisson process?
> The built-in Ticker in ticker.go uses a runtimeTimer that has a field 
> called period.
> I would like to implement a "random ticker" such that each tick interval 
> is random, using ExpFloat64() * d, with average duration d, instead of a 
> fixed interval.
> I could have a go routine that sleeps a random amount of time in a loop, 
> but it would be nice to use something similar to the ticker.
>
> BR,
> David
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to