In the RNG documentation there appears to be an error...

asked 2014-06-20 18:04:14 -0500

joeish80829 gravatar image

updated 2014-06-22 09:18:22 -0500

At this link:

http://docs.opencv.org/trunk/modules/core/doc/operations_on_arrays.html?highlight=rng#RNG::RNG()

it says:

"These are the RNG constructors. The first form sets the state to some pre-defined value, equal to 2**32-1 in the current implementation. The second form sets the state to the specified value. If you passed state=0 , the constructor uses the above default value instead to avoid the singular random number sequence, consisting of all zeros."

what is this statement, 2**32-1, referring to? Should it be 2*32-1, or does ** have some signigicance in c++.

edit retag flag offensive close merge delete

Comments

it's just 0xFFFFFFFF, a 32 bit number with all bits set to one

i think, above is just a lengthy explanation, that you can't use 0 as a seed (because all random values generated from that are 0 again)

berak gravatar imageberak ( 2014-06-21 02:39:20 -0500 )edit

2**32 is probably more python than c.

it's the equivalent of pow(2,32) or (1<<32)

berak gravatar imageberak ( 2014-06-22 09:23:06 -0500 )edit