Re: [go-nuts] ticker for poisson processes?

2018-10-03 Thread David Wahlstedt
Perhaps line 51 should be: sec := time.Duration(rand.ExpFloat64() * float64(t.period)) to get tick. (0s) tick. (5.872982ms) tick. (5.37282ms) tick. (12.310533ms) ... instead of tick. (0s) tick. (0s) tick. (10ms) tick. (30ms) tick. (0s) tick. (0s) Den onsdag 26 september 2018 kl. 17:33:29 UTC+2

Re: [go-nuts] ticker for poisson processes?

2018-09-27 Thread Tristan Colgate
Both use the runtime timers underneath. Ticker requires an extra channel send. Tracking this down was interesting! On Thu, 27 Sep 2018, 14:56 David Wahlstedt, wrote: > I mean that an ordinary go thread executing a sleep instruction may risk > to be starved by the scheduler, so the real

Re: [go-nuts] ticker for poisson processes?

2018-09-27 Thread David Wahlstedt
I mean that an ordinary go thread executing a sleep instruction may risk to be starved by the scheduler, so the real sleeping time is likely to be longer. But with the ticker, a incoming message in the channel waking up a routine that waits for it, things may behave differently? /David Den

Re: [go-nuts] ticker for poisson processes?

2018-09-26 Thread Sebastien Binet
On Wed, Sep 26, 2018 at 2:29 PM David Wahlstedt < david.wahlstedt@gmail.com> wrote: > Thanks--nice! > Will this be less reliable than the built-in Ticker (that uses > runtimeTimer), besides the intentional randomness? > modulo the possible bug(s) I may have unintentionally introduced, I

Re: [go-nuts] ticker for poisson processes?

2018-09-26 Thread David Wahlstedt
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 > wrote: > >> Hi, >> What would

Re: [go-nuts] ticker for poisson processes?

2018-09-25 Thread Sebastien Binet
On Tue, Sep 25, 2018 at 11:34 AM David Wahlstedt < david.wahlstedt@gmail.com> 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