The Daily Click ::. Forums ::. Klik Coding Help ::. Random numbers
 

Post Reply  Post Oekaki 
 

Posted By Message

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
9th December, 2008 at 10:16:01 -

What's the best way to generate a random number between 0 and 1? I'm not happy with how the MT object does it - seems that 40% of the numbers are between 0.7 and 1

 
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

W3R3W00F

Drum and Bass Fueled Psycho

Registered
  08/11/2008
Points
  370

VIP MemberCardboard BoxThe Cake is a Lie
9th December, 2008 at 14:24:13 -

I'm not so sure. I don't think there IS another way. I'd be surprised if there was.

 
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
9th December, 2008 at 17:03:55 -

Well, MMF2 can handle decimals so... I'd say random(100) (or whatever the syntax is) multiplied by .001 (or divided by 100) makes sense. Can't try it though, don't have MMF2. It probably doesn't, because it seems too obvious... >_O

Edited by OMC

 

  		
  		

Ricky

loves Left For Dead 2

Registered
  28/12/2006
Points
  4175

Has Donated, Thank You!Game of the Week WinnerVIP MemberWii OwnerHero of TimeGOTM Winner! - November 2009I am an April Fool
9th December, 2008 at 17:42:37 -

This won't look good if you are constantly doing it, but it will appear random if you just use it occasionally.

seconds of( "Date & Time" ) mod 2

 
-

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
9th December, 2008 at 17:44:15 -

OMC .001 is thousandths

 
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
9th December, 2008 at 17:46:25 -

Whoops. One too many 0's there. My brain is fried from exams, bear with me.

 

  		
  		

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
11th December, 2008 at 12:16:12 -

I actually made a random number testing thingy.. and it suggests that the random numbers are fine, with only a +/- 5% difference in what it should be after 10000 samples. Both the default MMF and the MT random have the same results.

Hmm.. I swear that the random number generator is messing with me. Maybe it's because I generate a number every second and seed it by time. Or something like that. I'm tempted to perform a hypothesis test, but it's not worth my time, unless someone complains to me about his character always getting hit in the leg or something

 
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
   

Post Reply



 



Advertisement

Worth A Click