Пример #1
0
long long z_random64() /* z_proto, z_func z_random64 */
{
  long long x;


  x =  ((long long) z_rand()) << 32;
  x |= ((long long) z_rand()) << 1;

  x |= ((long long) z_rand()) & 0x1;
  
  return x;
}
Пример #2
0
unsigned long long z_random64u() /* z_proto, z_func z_random64u */
{
  unsigned long long x;
  

  x =  ((unsigned long long) z_rand()) << 32;
  x |= ((unsigned long long) z_rand()) << 1;

  x <<= 1;
  x |= ((unsigned long long) z_rand()) & 0x3;
  
  return x;
}
Пример #3
0
// Square enemy
//------------------------------
Square::Square( const Vec2& position, fixed rotation )
: Enemy( position, 4 )
, _dir()
, _timer( z_rand() % 80 + 40 )
{
    AddShape( new Box( Vec2(), 10, 10, 0x33ff33ff, 0, ENEMY | VULNERABLE ) ); _dir.SetPolar( rotation, M_ONE );
    SetScore( 25 );
    SetBoundingWidth( 15 );
    SetEnemyValue( 2 );
}
Пример #4
0
unsigned long long z_random64u_minmax(unsigned long long min, unsigned long long max) /* z_proto, z_func z_random64u_minmax */
{
  long double r;
  unsigned long long x;


  r = (long double) z_rand() / (long double) Z_RAND_MAX;
  
  x = (long long) (((long double) (max - min) * r) + 0.5);
  
  x += min;

  if (x > max) x = max;
  
  return x;
}
Пример #5
0
double z_urandom() /* z_proto, z_func z_urandom */
{
  double r[1] = { 0 };

#if defined(HAVE_ESSL_H)
/*  printf("durand\n");*/
  durand(&z_urandom_seed_essl, 1, r);
#elif defined(HAVE_T4C_H)
/*  printf("t4c_durand\n");*/
  t4c_durand(r);
#else
/*  printf("random() / RAND_MAX\n");*/
  r[0] = (double) z_rand() / (double) Z_RAND_MAX;
#endif

/*  printf("z_urandom: %f\n", r[0]);*/

  return r[0];
}