adapt to different versions of the random function in various databases