uint16_t mesg_id (void) {
        static int range = 0; /* indicates that no permutation has been generated yet */
        static int index;

        if (!range) {
                srandom(time(0)); 	/* initialize random number generator seed */
                range = 1;		/* choose the lower range first */
                make_random_permutation(LOW_START);
                index = 0;		/* start from the first element */
        }
        if ( index == NUM_USE ) {	/* if the pool is exhasuted */
                if (range == 1) {
                        range = 2;	/* choose the higher range */
                        make_random_permutation(HIGH_START);
                }
                else {
                        range = 1;	/* choose the lower range */
                        make_random_permutation(LOW_START);
                }
                index = 0;
        }
	if (T.debug > 4) { 
		syslog (LOG_DEBUG, "mesg_id() = %d", permutation[index]);
        }
        return permutation[index++];
}
uint16_t mesg_id (void) {
        static int range = 0;  
        static int index;

        if (!range) {
                srandom(time(0)); 	 
                range = 1;		 
                make_random_permutation(LOW_START);
                index = 0;		 
        }
        if ( index == NUM_USE ) {	 
                if (range == 1) {
                        range = 2;	 
                        make_random_permutation(HIGH_START);
                }
                else {
                        range = 1;	 
                        make_random_permutation(LOW_START);
                }
                index = 0;
        }
	if (T.debug > 4) { 
		syslog (LOG_DEBUG, "mesg_id() = %d", permutation[index]);
        }
        return permutation[index++];
}