[Gambas-user] Rnd Wiki

Demosthenes Koptsis demosthenesk at ...626...
Thu Nov 25 17:24:46 CET 2010


I wrote something that i think describes better the Rnd().

If you like it you can use or modify it for the wiki.

------------------------------------------------------------------------
Float = Rnd ( [ Min [ , Max ] )

Compute a pseudo-random floating point number between a lower Min limit
value and an upper Max limit value. 

# If no parameters is specified the default value for lower limit, Min, 
  is 0 and for upper limit, Max, is 1. 
  The function returns a pseudo-random number in the interval [ 0 , 1 ].

# If only one parameter is specified this parameter is used as the 
  upper limit, so argument1, Min will be used as upper limit. The  
  lower limit is by default 0. 
  The function returns a pseudo-random in the interval [ 0 , Min ].

# If both parameters are specified, Min is the lower limit and Max the
  upper limit.
  The function returns a pseudo-random in the interval [ Min , Max ]. 

Note that the higher born of the interval is never returned. 
....
------------------------------------------------------------------------


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
> 
> 
> 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 [.
> 
>  * 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