Fct_Random_Int

 

Return a random floating point values between 0 and 0xFFFF FFFF

 

 

Syntax

 

unsigned int Fct_Random_Int(

          void

) ;

 

 

Parameters

 

This function does not have a parameter.

 

 

Return value

 

This function return a random unsigned integer 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

 

...

 

extern "C" __declspec(dllexport) int          Init( void )

{

int          i ;

static          int start_color[] = {          0x00000000, 0x000000ff, 0x0000ff00, 0x00ff0000,

                                        0x00Cf00Cf, 0x0000ffff, 0x00006fff, 0x00CfCf00,

                                        0x007f00Cf, 0x00ff7f00, 0x00ffD0D0, 0x0000D000,

                                        0x00D0E000, 0x00D06fff, 0x00ff007f, 0x0000C0C0 } ;

 

          ...

 

          // --- Assign colors to the TAGs. The first 16 colors are hard coded ---

          for ( i=0; i < 16; i++ ) {

              TAG_Red[i] = (RED_BYTE( start_color[i] ) << 8) | RED_BYTE( start_color[i] ) ;

              TAG_Grn[i] = (GRN_BYTE( start_color[i] ) << 8) | GRN_BYTE( start_color[i] ) ;

              TAG_Blu[i] = (BLU_BYTE( start_color[i] ) << 8) | BLU_BYTE( start_color[i] ) ;

          }

 

          // --- the remaining colors come from a random with a fixed seed ---

          Fct_Random_Seed( 1 ) ;

          Fct_Random_Int() ;

          for ( ; i < TAG_Max; i++ ) {

              Color col ;

              col.color = Fct_Random_Int() & 0x0FFFFFF ;

              TAG_Red[i] = (col.col.R << 8) | col.col.R ;

              TAG_Grn[i] = (col.col.G << 8) | col.col.G ;

              TAG_Blu[i] = (col.col.B << 8) | col.col.B ;

          }

          ...

}

...

 

 

See also

 

Fct_Random_Seed

Fct_Random_Float