Core: Add GUID method

Replace separate random ID generators with a single implementation.
Having a single stub-able method will make it easier for testing.
Merge pull request #5315 from nschonni/wb-guid-method

Core: Add GUID method