stdlib.h
/* Maximum value that can be returned by the rand function. */
#define RAND_MAX 0x7fff //才3万多点
看看linux的
/* The largest number rand will return (same as INT_MAX). */
#define RAND_MAX 2147483647
这才靠谱啊
...全文
94336打赏收藏
windows 下的随机数太扯淡了
stdlib.h /* Maximum value that can be returned by the rand function. */ #define RAND_MAX 0x7fff //才3万多点 看看linux的 /* The largest number rand will return (same as INT_MAX). */ #define RAND_MAX 2147483647 这才靠谱啊
没错,能生成0、1随机的理想随机数发生器可以构造任何随机数。[/quote]
你们是在混淆概念!
theoretical of computer science 里面的随机数生成器只产生0,1是因为基于图灵机的模型,每次只产生一个比特位,此时还需要考虑output的bit length,组合在一起才能当PRNG。你们拿alpha当string,这是很不厚道的偷换概念!
楼主抱怨的没错!针对现在应用最广泛的随机数生成算法,无论是(truncated) linear congruential generator,还是polynomial pseudo-random number generator,如果模数太小,确实会导致周期变小。关于这个问题在<The Art of Computer Programming>第二卷3.2.1.1节有详细的介绍。 [/quote]
lz可没抱怨周期太短。他只是纯粹在抱怨范围,看18L。
他要真抱怨周期的话,我当然是另一种回复。
CoCreateGuid
Creates a GUID, a unique 128-bit integer used for CLSIDs and interface identifiers.
HRESULT CoCreateGuid(
GUID *pguid //Pointer to the GUID on return
);
Parameter
pguid
[out] Pointer to the requested GUID on return.
Return Value
S_OK
The GUID was successfully created.
Win32 errors are returned byUuidCreate but wrapped as an HRESULT.
Remarks
The CoCreateGuid function calls the RPC function UuidCreate, which creates a GUID, a globally unique 128-bit integer. Use the CoCreateGuid function when you need an absolutely unique number that you will use as a persistent identifier in a distributed environment.To a very high degree of certainty, this function returns a unique value – no other invocation, on the same or any other system (networked or not), should return the same value.
QuickInfo
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in objbase.h.
Import Library: Included as a resource in ole32.dll.
See Also
UuidCreate