The Daily Click ::. Forums ::. Klik Coding Help ::. random with decimals
 

Post Reply  Post Oekaki 
 

Posted By Message

badm1nton



Registered
  01/02/2009
Points
  14
23rd June, 2009 at 00:54:08 -

hi,
how do i make the random generator spit out a number with decimals ?
random(6.0)-3.0 doesnt seem to work.

sorry for the stupid question.


update:
got it working
(random(60)-30)/10.0
is this the only way to do it ?

Edited by badm1nton

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
23rd June, 2009 at 01:09:19 -

It's the way I was going to suggest.

 

  		
  		

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
23rd June, 2009 at 07:42:36 -

Yeah, I think that's the only way. Random(100) just generates a hundred numbers between 0 and 99, nothing between.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
23rd June, 2009 at 08:03:23 -

Yep, it generates an integer so you would need to divide it down by a decimal place.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click