Thanks--nice!
Will this be less reliable than the built-in Ticker (that uses 
runtimeTimer), besides the intentional randomness?

/David

Den tisdag 25 september 2018 kl. 18:43:33 UTC+2 skrev Sebastien Binet:
>
>
>
> On Tue, Sep 25, 2018 at 11:34 AM David Wahlstedt <david.wah...@gmail.com 
> <javascript:>> 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.
>>
>
> just for fun:  https://play.golang.org/p/kt0qVQ41E1C
> (yes, it uses a goroutine that sleeps a random amount of time in a loop.)
>
> -s
>

-- 
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