If not, you use some random method to generate tinyURLs until you get one that's not already in your database ...
Personally (i.e. I don't know if they are doing that way), I would
just count issued tinyURLs (the count might come directly from the
database), and represent that number in some number base, e.g. 62 for
the printable chars you've specified.
The advantage would be that it's
simpler in the following ways: (1) I wouldn't have to check whether
some randomly generated number is already in use, and (2) would be able
to have the number of required digits grow just as needed, so the
tinyURL is always as compact as possible. (With a random number, I'd have
to choose ahead what width to use. Also, as full utilisation of the set
is being approached, searching for a remaining free number would
require more and more iterations...).