VirtualBox

Changeset 893 in vbox for trunk/src/VBox/Runtime/generic


Ignore:
Timestamp:
Feb 14, 2007 9:36:39 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18610
Message:

Use RTRand.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/generic/uuid-generic.cpp

    r204 r893  
    2929#include <iprt/time.h>
    3030#include <iprt/asm.h>
     31#include <iprt/rand.h>
    3132
    3233
     
    4546    AssertReturn(pUuid, VERR_INVALID_PARAMETER);
    4647
    47     /*
    48      * We don't have any good random sources in IPRT yet, so
    49      * for the time being we'll use Nano time and the cpu TSC
    50      * (which of course isn't very good at all!).
    51      */
    52     RTTIMESPEC Now;
    53     pUuid->au64[0] = RTTimeSpecGetNano(RTTimeNow(&Now));
    54     pUuid->au64[1] = ASMReadTSC();
     48    RTRandBytes(pUuid, sizeof(*pUuid));
    5549    pUuid->Gen.u16ClockSeq = (pUuid->Gen.u16ClockSeq & 0x3fff) | 0x8000;
    5650    pUuid->Gen.u16TimeHiAndVersion = (pUuid->Gen.u16TimeHiAndVersion & 0x0fff) | 0x4000;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette