library/src/utility/BP-NumberUtilities.cc
// Generates a size_t * array of values which exist between the specified min and max values.
Generates a size_t * array of values which exist between the specified min and max values.
Generates a size_t * array of values which exist between the specified min and max values .
size_t * BP_GenRandomUnsignedLongArray(size_t arr_elems, size_t min_val, size_t max_val)
{
	if(!arr_elems)
		return NULL;
	size_t * elems = (size_t *) bpcalloc(sizeof(size_t) * (arr_elems + 1), 1);
	size_t n = 0;
	for(; n < arr_elems; n++)
		elems[n] = BP_GenRandomUnsignedLong(min_val, max_val);
	if(!elems)
		return NULL;
	return elems;
}
size_t * BP_GenRandomUnsignedLongArray ( size_t arr_elems , size_t min_val , size_t max_val ) { if ( ! arr_elems ) return NULL ; size_t * elems = ( size_t * ) bpcalloc ( sizeof ( size_t ) * ( arr_elems + 1 ) , 1 ) ; size_t n = 0 ; for ( ; n < arr_elems ; n ++ ) elems [ n ] = BP_GenRandomUnsignedLong ( min_val , max_val ) ; if ( ! elems ) return NULL ; return elems ; }
Generates a size_t * array of values which exist between the specified min and max values.
Generates a size_t * array of values which exist between the specified min and max values .
// check to make sure that the element size request is non-zero // generate elements (automatically null terminates arrays last pointer) // walk the element place holders and generate individual values // return null on allocation failure // return the elements