Page 1 of 1

Quick question 'bout Rand

PostPosted: Aug 10, 2007 @ 9:51pm
by Ryumaster
Hi!

ecd->math->Rand(-1,1)

always gives the same number. How to randomise it for smart devices? srand() or something else?

PostPosted: Aug 12, 2007 @ 12:01am
by edge
Hi Ryumaster,

Have you tried SetRandSeed? Find more info here: http://www.edgelib.com/index.php?node=c ... etrandseed

Regards,

PostPosted: Aug 12, 2007 @ 7:37pm
by Ryumaster
Oh! Thank you, I've missed it somehow.

PostPosted: Aug 13, 2007 @ 11:00am
by Ryumaster

PostPosted: Aug 14, 2007 @ 8:56am
by edge
Hi Ryumaster,

Unfortunately, it's not possible to generate negative random numbers yet. That's why the function is returning the wrong values. A quick workaround is to generate a positive number, and subtract a value from it to make it negative.

Generating negative numbers will be possible in the upcoming EDGELIB version which is to be released very soon.