[BGL] reset of the random number generator in the sorted_erdos_renyi_iterator
Hi, I noticed that when generating several graphs with the sorted_erdos_renyi_iterator with the same random generator all of them happen to be the same. Looking at erdos_renyi_generator.hpp I see that there is a reset in the generator. This does not happens in the normal (unsorted) erdos_renyi_iterator since the generator is passed by reference in the constructor. I'm still not confortable with the BGL and the random libraries, but I might say that it is better to pass the random generator by reference. Is there a special reason for not doing so? Thank you, MartÃ
On Thu, 8 Oct 2009, Marti Cuquet wrote:
Hi,
I noticed that when generating several graphs with the sorted_erdos_renyi_iterator with the same random generator all of them happen to be the same. Looking at erdos_renyi_generator.hpp I see that there is a reset in the generator.
This does not happens in the normal (unsorted) erdos_renyi_iterator since the generator is passed by reference in the constructor.
I'm still not confortable with the BGL and the random libraries, but I might say that it is better to pass the random generator by reference. Is there a special reason for not doing so?
The generator needs to be wrapped in the constructor (even though it is passed by reference) in order to get a uniform_01 interface from it. Please check r56651 to see if it addresses your issue; I changed the construction of the wrapper to use a pointer to the generator instead. Thank you for noticing this issue. -- Jeremiah Willcock
Jeremiah Willcock wrote:
On Thu, 8 Oct 2009, Marti Cuquet wrote:
Hi,
I noticed that when generating several graphs with the sorted_erdos_renyi_iterator with the same random generator all of them happen to be the same. Looking at erdos_renyi_generator.hpp I see that there is a reset in the generator.
This does not happens in the normal (unsorted) erdos_renyi_iterator since the generator is passed by reference in the constructor.
I'm still not confortable with the BGL and the random libraries, but I might say that it is better to pass the random generator by reference. Is there a special reason for not doing so?
The generator needs to be wrapped in the constructor (even though it is passed by reference) in order to get a uniform_01 interface from it. Please check r56651 to see if it addresses your issue; I changed the construction of the wrapper to use a pointer to the generator instead. Thank you for noticing this issue.
Yes, this solves the problem. Thank you. Marti Cuquet
participants (2)
-
Jeremiah Willcock
-
Marti Cuquet