cin >> number;
int allocAmount = number + (rand() % number);
pointer = new type[allocAmount];
// Amount of memory allocated == allocAmount
// (unless line 3 throws an exception, of course)
I'm pretty sure that the size information for new[]/delete[] is stored in some compiler-specific way (in other words, it could be different depending on the compiler).
So either use a variable like I showed above, or consider using std::vector instead: