473,799 Members | 3,084 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

implementation of rand() ?

Hi,

What is the implementation of rand() on say visual c/c++ 5 or 6 ?

Another question... is this rand() implementation the same on any other
platforms/compilers/libraries ?

Where can I find/look at the implementation of rand() ?

Thx for any help.

Bye,
Skybuck.
Nov 14 '05 #1
4 3484
Skybuck Flying wrote:
Hi,

What is the implementation of rand() on say visual c/c++ 5 or 6 ?

Another question... is this rand() implementation the same on any other
platforms/compilers/libraries ?

Where can I find/look at the implementation of rand() ?

Thx for any help.


He's ba-a-a-ck ... (A little Googling of SF's past,
er, "contributi ons" is suggested before replying.)

--
Er*********@sun .com

Nov 14 '05 #2
Well I have moved this discussion to sci.crypt etc... since it is more
relevant there...

See the thread:

'Hunt for rand and srand implementations '

So far I have found no implementations for visual c/c++ 6.0 (I think... I
should retry the ones I found ;) )

I did find IBM_AIX and POSIX implementations ...

Any other implementations are welcome especially for redhat, debian, etc...
I am not sure if those are the same...

Any links for finding linux source code for those distributions on the web
like cvs etc are welcome ;)

Bye,
Skybuck.
Nov 14 '05 #3
Eric Sosman wrote:
Skybuck Flying wrote:
.... snip ...
Where can I find/look at the implementation of rand() ?
Thx for any help.


He's ba-a-a-ck ... (A little Googling of SF's past,
er, "contributi ons" is suggested before replying.)


If you hadn't commented I would never have noticed. I wouldn't
have regretted that either. To the tune of "That's what plonks are
for".

--
Chuck F (cb********@yah oo.com) (cb********@wor ldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net> USE worldnet address!
Nov 14 '05 #4
In article <cl**********@n ews6.zwoll1.ov. home.nl>, no****@hotmail. com says...
Well I have moved this discussion to sci.crypt etc... since it is more
relevant there...
You having pulling this "verbose mode enabled" thing in various newsgroups
for years, that's not news.

See the thread:

'Hunt for rand and srand implementations '
Look, if you want a decent random number generator, and you don't
trust the one that comes with your compiler, google for "mersenne twister".

If you need one good enough for crypto, that's not it. Instead, take it
up with the gurus in sci.crypt. Either way, it's OT here.
So far I have found no implementations for visual c/c++ 6.0 (I think... I
should retry the ones I found ;) )
The compiler comes with source code for the C runtime library. If you
installed your compiler with the source (or go back and reinstall it now),
just like in VC98\CRT\SRC\ra nd.c under whatever you directory you installed
the compiler to. You should know this already.
I did find IBM_AIX and POSIX implementations ...
You think PRNG's care about the OS?
Any other implementations are welcome especially for redhat, debian, etc...
I am not sure if those are the same...


*sigh*

--
Randy Howard (2reply remove FOOBAR)

Nov 14 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2516
by: David Mertz, Ph.D. | last post by:
I decided to write a pure Python hashcash implementation. I have seen David McNab's Python implementation. Unfortunately, as near as I can tell (which is supported on the hashcash mailing list archive), McNab actually implements a different algorithm than hashcash. It might (or might not) be equivalent in security; but I cannot see any directly way to transform what he computes into an actual hashcash stamp. Barnes Connelly also...
31
4445
by: Scott Robert Ladd | last post by:
I've posted my revised C++ implementation of the Mersenne Twister at: http://www.coyotegulch.com/libcoyote/TwistedRoad/TwistedRoad.html This is "free-as-in-liberty" and "free-as-in-beer" code. The Mersenne Twister is a "random number" generator invented by Makoto Matsumoto and Takuji Nishimura; their website includes numerous implementations of the algorithm.
36
2696
by: Profetas | last post by:
Hi, I want to generate a random 8 bit number using rand(0 is that possible? to expecifu the base and the lenght? thanks
0
2284
by: Skybuck Flying | last post by:
I found some rand source code on this link: http://www.codeguru.com/forum/showthread.php?t=312416&goto=nextnewest void __cdecl srand (unsigned int seed) { #ifdef _MT _getptd()->_holdrand = (unsigned long)seed; #else /* _MT */ holdrand = (long)seed;
4
2798
by: Siam | last post by:
Hi all, I'm writing a shell language in c++ that supports the generation of random numbers, and by its nature, each command must be executed in a new thread. The call to the random function from my language simply propogates up to the rand( ) function from c++. For some reason, C++ will give each thread independent use of their own rand( ) function, so that a rand( ) call from one thread won't affect another thread's call to rand( )....
9
7802
by: asaguiar | last post by:
Hi, Given the pseudocode explanation of the Kahan algorithm at http://en.wikipedia.org/wiki/Kahan_summation_algorithm, I tried to implement it in C. It is supposed to minimize the effect of base conversion errors after repeated sum operations. However, the effect is null. The rounding error persists without change. My implementation is:
40
3663
by: Spiros Bousbouras | last post by:
Do you have an example of an implementation where sizeof(short int) does not divide sizeof(int) or sizeof(int) does not divide sizeof(long int) or sizeof(long int) does not divide sizeof(long long int) ? Same question for the corresponding unsigned types.
5
2325
by: ds | last post by:
Hi all, rand() is not thread safe, a fact that may not be so bad after all.. However, I face the following problem: a piece of code uses rand() to get a random sequence, but always seeds with the same seed for reproducibility of the results. Now I am porting this (old C89) code and have setup a nice app with threads that drives on one thread the old code and on another the new code, so that I can compare the results and see that nothing...
3
3455
by: pereges | last post by:
I just tried to write a small program based on it : #include <stdio.h> #include <stdlib.h> #define PRECISION 2.82e14 double drand48(void) {
0
9538
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10249
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10219
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10025
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7563
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6804
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4138
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.