Ok, here's what I would do. Find a way to randomly determine an amount of extra spells that a wizard has scribed. Make it dependant on level as well as a factor that the user can determine if he wants (to take into account low-magic or high-magic campaigns). Don't bother determining which level these extra spells are; that will be taken care of in the following step.
Then, create a table that for each spell lists a relative rarity. It should take into account the level of the spell (higher level spells are substantially rarer) as well as that spell's usefulness (more useful spells are more common). To reduce the size of that table, which would be a pain to write down, I suggest that you set a default weightl, except if otherwise declared in the table. This way you only have to make table entries for spells that are especially rare or common. The default could be something like 100 * spell level. Store the table in an easily editable text file.