ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to get a different random sequence with OpenCV RNG? [closed]

asked 2014-06-12 01:30:02 -0600

Luis Ruiz gravatar image

updated 2016-03-18 07:33:53 -0600

I am using OpenCV to create some random numbers. I initialize the generator as:

RNG rng( 0xFFFFFFFF );

And then to get a number:

rng.uniform( 0, 100);

But everytime I run my program the generated sequence is the same. How do I get a different sequence?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Luis Ruiz
close date 2014-06-17 23:03:11.317947

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-06-16 08:02:05 -0600

Wolf gravatar image

As stated in the doc

http://docs.opencv.org/modules/core/d...

RNG takes a seed as arg. If you need a different sequence every time you have to initialize it with a different value every time, e. g. use time, thread id or some thing like this as seed....

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-06-12 01:30:02 -0600

Seen: 2,808 times

Last updated: Mar 18 '16