Re: strange behavior of random numbers with gtkmm
- From: Oscar Lazzarino <oscar lazzarino i-m3d com>
- To: gtkmm-list gnome org
- Subject: Re: strange behavior of random numbers with gtkmm
- Date: Wed, 16 Jun 2010 10:10:10 +0200
On 06/15/2010 10:41 PM, jody wrote:
My problem is not that i do get the same sequence.
My problem is that the first time i get a different sequence than the following
time even though i always use the same seed.
[CUT]
@oscar: did you make sure *not* to press the reset button before you
press the 'step' button the first time? So that
the first call to random() follows the srand() call triggered in the
constructor?
Yep. If I press RESET before STEP I get
Reset
Reset <----- one more RESET
One step: 1889402444
One step: 1202690506
One step: 785052894
Reset
One step: 1889402444
One step: 1202690506
One step: 785052894
Reset
One step: 1889402444
One step: 1202690506
One step: 785052894
But if I press STEP (and never press RESET) I get
Reset
One step: 1889402444
One step: 1202690506
One step: 785052894
Reset
One step: 1889402444
One step: 1202690506
One step: 785052894
Reset
One step: 1889402444
One step: 1202690506
One step: 785052894
In both case the numbers are always the same, as expected.
BTW: I have gtkmm 2.16.0 and gtk+ 2.16.6
Also tried with gtkmm 2.18.2 and gtk+ 2.18.6
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]