[Gambas-user] Rnd Wiki

Demosthenes Koptsis demosthenesk at ...626...
Thu Nov 25 15:01:14 CET 2010


On Thu, 2010-11-25 at 14:26 +0100, Fabien Bodard wrote:
> if i wrote that like a function ...
> 
> rnd(min as float, max as float)
> 
> the variable named min don't change his name
> 
> i think benoit should take others name than min/max

i am not confused about min, max, i understand that these are the lower
limit and upper limit of range min-max.

That's ok.

> 
> val1/val2 ?
> 
> Float = Rnd ( [ Val1 [ , Val2 ] )
> 
> 
> * If no parameters is specified, returns a pseudo-random number in the
>   interval [ 0 , 1 [.
> 
>  * If only one parameter is specified it is Max value, returns a
> pseudo-random in the
>    interval [ 0 , Val1 [.

ok one paramater is the max value!

at this point i see in wiki this

If only one parameter is specified, returns a pseudo-random in the
interval [ 0 , Min [.


it confuses me that

[ 0 , Min [.


i understand it better as 

range
[0 - Max] or in your example range [0, Val2] not Val1.

Because the lower limit is Min=0 and upper limit is Max=Val2.

Example
' Between 0 and 2
PRINT Rnd(2)

Min=0, Max=2
Val1=0, Val2=2

it is equal

PRINT Rnd(0, 2)
Min=0, Max=2
Val1=0, Val2=2


>  * If the two parameters are specified they are Min, Max values,
>    returns a pseudo-random in the interval [ Val1 , Val2 ].
> 
> 
> --
> Fabien Bodard
> 
> ------------------------------------------------------------------------------
> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
> Tap into the largest installed PC base & get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with the
> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user

-- 
Regards,
Demosthenes Koptsis.





More information about the User mailing list