Fct_Random_Float

 

Return a random floating point values between -1.0 and 1.0.

 

 

Syntax

 

float Fct_Random_Float(

          void

) ;

 

 

Parameters

 

This function does not have a parameter.

 

 

Return value

 

This function return a random floating point value.

 

 

Remarks

 

This random number generator is based on the algorithm presented in "Random Number Generators: Good ones are hard to find", Stephen K. Park and Keith W. Miller, Communications of the ACM, Vol 31, Num10, October 1988.

 

 

Requirements

 

Header:

          sliceO_include.hpp

 

 

Library:

          sliceO_Structures.lib

 

 

 

Example

 

...

 

SLICEO_DB          int          Fct_Point_2D_Insert( unsigned short flag, SliceO_Window *window, SliceO_Frame *frame, int id )

{

          ...

 

          // --- assign default random saturated color ---

          float          red, grn, blu ;

          float hue = (Fct_Random_Float() + 1.0f) / 2.0f;

          HLS_to_RGB( hue, 0.5f, 1.0f,  &red, &grn, &blu ) ;

          (*Point_Cur)->Color_Set( (unsigned char) (red * 255),

                                        (unsigned char) (grn * 255),

                                        (unsigned char) (blu * 255) ) ;

          ...

}

 

...

 

 

See also

 

Fct_Random_Seed

Fct_Random_Int