Use get random bytes as uniqeid() is not unique in some cases

Fix #9161 

@DeepDiver1975 @PVince81 @karlitschek @icewind1991 @bantu