Ask Your Question
1

Random Number Generation regarding

asked 2014-08-01 01:02:00 -0600

sabariaug23 gravatar image

updated 2015-12-29 20:18:25 -0600

I had generated a random number using the following code in OpenCV 2.4.8.

RNG rng;
cout << rng.uniform(0.0,1.0);

It keeps on generating the same number. Why?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-08-01 01:04:51 -0600

berak gravatar image

"It keeps on generating the same number. Why?"

you will have to seed the RNG, else it starts with ~0 for seed all the time.

RNG rng(getTickCount());
edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-08-01 01:02:00 -0600

Seen: 355 times

Last updated: Aug 01 '14