Page 1 of 1 1
Topic Options
#122426 - 2004-07-08 08:22 PM Randomize using decimal places
Microcyb Offline
Getting the hang of it

Registered: 2002-12-30
Posts: 95
Loc: Hell
How can you randomize using decimal (double).
instead of rnd(3) generating 1, 3, etc.

I want to have 0.001, 0.003, etc.

I have tried formatnumber and set the varible to 0.00, but nothing seems to work.

I will get 1,2,3 or 1.00, 2.00, 3.00 but never can get 0.01, 0.02, 0.03 as a result.
_________________________
www.microcyb.com

Top
#122427 - 2004-07-08 08:31 PM Re: Randomize using decimal places
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
what about:

$x = 0.001 * rnd(1000)


Edited by Howard Bullock (2004-07-08 08:34 PM)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#122428 - 2004-07-08 08:40 PM Re: Randomize using decimal places
Microcyb Offline
Getting the hang of it

Registered: 2002-12-30
Posts: 95
Loc: Hell
Quote:

what about:

$x = 0.001 * rnd(1000)





Oh my lord!

I feel so dumb now that you have pointed that out.

Thank you!!!
_________________________
www.microcyb.com

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.054 seconds in which 0.027 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org