This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Quick question 'bout Rand


Quick question 'bout Rand

Postby Ryumaster » Aug 10, 2007 @ 9:51pm

Hi!

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

always gives the same number. How to randomise it for smart devices? srand() or something else?
I love postindustrial life.
User avatar
Ryumaster
pm Member
 
Posts: 86
Joined: Sep 17, 2006 @ 11:24am
Location: Lithuania, Kaunas


Postby edge » Aug 12, 2007 @ 12:01am

Hi Ryumaster,

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

Regards,
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Postby Ryumaster » Aug 12, 2007 @ 7:37pm

Oh! Thank you, I've missed it somehow.
I love postindustrial life.
User avatar
Ryumaster
pm Member
 
Posts: 86
Joined: Sep 17, 2006 @ 11:24am
Location: Lithuania, Kaunas


Postby Ryumaster » Aug 13, 2007 @ 11:00am

I love postindustrial life.
User avatar
Ryumaster
pm Member
 
Posts: 86
Joined: Sep 17, 2006 @ 11:24am
Location: Lithuania, Kaunas


Postby edge » Aug 14, 2007 @ 8:56am

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.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron