In a library, (and I'm not totally sure about this, but from experience) books are organized by category/theme into sections, and then they are given a number so that, globally, the numbers are ordered sequentially. This way you can easily just look up a number and go right to it, but then you can also browse entire sections by a common theme. I'm not sure how exactly they do this, but this is roughly what I've seen how it works.
So I'm wondering how biological specimens are organized in a gigantic specimen archive like at a large museum or university collection, with hundreds of thousands or millions of specimens. I'm wondering if they just give them a random number, and then place them wherever that number falls in the sequence. Or if they do like the libraries and group them by category/theme, then by number. Or something different.