Random Functions

About advanced scenes, and the Thyme scripting language used in Algodoo.

Random Functions

Postby Xray » Mon Apr 22, 2013 6:36 pm

I read in another thread that Thyme now has a few new random number generators. They are:
rand.boolean
rand.direction2D
rand.normal
rand.normal2D
rand.uniform01

Does anyone know what the range of the output values for each of these is?

Thanks
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Random Functions

Postby jon_joy_1999 » Mon Apr 22, 2013 8:56 pm

rand.boolean returns TRUE or FALSE
rand.direction returns a vector of 2 values with the range of -1 to 1 for each
rand.normal seems to output values between -Pi and Pi, however one call returned 3.4954469 so I'm not sure what the max is
I'm not sure what rand.uniform01 returns, but I would guess it would return random numbers between -1 and 1 with a uniform distribution
Image
BSrac = BoincStats recent average credit
I'd rather be network computing.
jon_joy_1999
 
Posts: 233
Joined: Fri Dec 09, 2011 12:51 am

Re: Random Functions

Postby electronicboy » Mon Apr 22, 2013 8:57 pm

Xray wrote:I read in another thread that Thyme now has a few new random number generators. They are:
rand.boolean
String Bool, True/False
rand.direction2D
Float Array, min/max -1 1
rand.normal
Float,
Unsure
Observed:
"L: -4.0329623
H: 4.1094446"

rand.normal2D
Float Array, Unsure
Observed:
"L: -3.6229534
H: 3.7236023"

I assume this will be the same as above, just this is pre-packaged in an array
rand.uniform01
Float, 0 - 1
Does anyone know what the range of the output values for each of these is?

Thanks


Using code;
Code: Select all
(e)=>{
    _a = Function();
    _a > _ah ? {_ah = _a} : {};
    _a < _al ? {_al = _a} : {}
}


Ps, above info is all collected using that code in the box and using small parts of my brain for rounding numbers like 0.9999994 :D
Most info was collected over 2-5 minutes of the code running, so please don't expect any accuracy at all!
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: Random Functions

Postby Xray » Mon Apr 22, 2013 10:43 pm

electronicboy and jon_joy -- Thanks very much for your explanations. They helped a lot. Unfortunately, it seems that you both have some uncertainty about some aspects of these functions. I was hoping that Emil himself would reply to this thread and/or publish details of these and other new Thyme functions that the newer version of Algodoo now has available. Doing so would reduce or eliminate confusion and uncertainty about how the functions are supposed to work.
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests