Custom function to add dedicated IDs for customers and vendors

Custom function to add dedicated IDs for customers and vendors

I'm currently looking for a way to automatically add an ID to customers and vendors. The difficulty is, that I need the customer ID to be in between the range 10000 until 69999 and the vendor numbers need to be in between 70000 until 99999.
How could I realise that using a custom function? 

The purpose for that is, that I need to use these numbers for DATEV in Germany.