RandInt and GenerateRandomCode20 always gives the same value?

Hello again,

I am currently writing codeunits for Automated Testing in BC. I tried the GenerateRandomCode20 and  RandInt from the Codeunit "Library - Utility" and Codeunit "Library - Random".But when i use them in different function the alwas create the same code what leads to the following error:

The record in table XYZ already exists. Identification fields and values: Packaging Code='GU000000060000000000',Line No.='0'
Some ideas how to avoid this behaviour?

Thank you in advance.