The invoice ID it shouldn't be a random number, I might be wrong but I believe under normal circumstances (unless an extension is already hooking in the contribution entity) the invoice ID is taken from the contribution ID.
As I'm not quite sure what is exactly what you want to achieve, here are some thoughts, I won't elaborate too much.
If what you want is to manually assign a invoice number, you can create a custom field, create a custom token for the given field and edit the invoice template (navigate to Administer - Communication - Message Templates - System Workflow Messages - Invoice receipt) replacing the invoiceID with your custom token.
If you want the custom invoice ID to be generated automatically every time a new contribution is submitted, I don't think there is a straight forward way to do it, as you will need an autoincrement value, and I can't think of an easy way to do that, mysql only allows one autoincrement column per table and when creating a custom filed, Civi creates a new table in the database with a autoincrement column, maybe some of the core team could point you in a better direction.
- (a bit of a workaround, maybe not the best way as I said) create a custom field group with an INT text/numeric field, using the appropriate hooks, save that filed in every Contribution submission and copy the value of the ID (autoincrement column) of the custom filed group to the custom filed itself so you can search by invoice id, create the custom token and modify the invoice template.
Hope I explained myself.