#include <iostream.h>
#include "BitArray.h"
#include <stdlib.h>
extern "C" double drand48( );
inline int
RandInt( int Low, int High )
{
return int( drand48( ) * ( High - Low + 1 ) + Low );
}
main( void )
{
int StillEmpty = 0;
int N;
int K = 1;
int i;
cout << "Enter N and K: ";
cin >> N >> K; BitArray B ( N ); cout << "B holds " << ( N = B.NumItems( ) ) << " bits\n";
for( i = 0; i < K * N; i++ )
B.SetBit( RandInt( 0, N - 1 ) );
for( i = 0; i < N; i++ )
if( !B.GetBit( i ) )
StillEmpty++;
cout << "After " << K * N << " random inserts, "
<< StillEmpty << " slots are still empty\n";
return 0;
}