C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 07-02-2008, 12:57 AM   #1
Registered User
 
Join Date: Feb 2008
Posts: 102
Question about random numbers

if I generate numbers with the same seed always...... does I will obtein always the same numbers when executing my program?

If I generate numbers with the same seed, but run the program in different machine, does I will obtein the same numbers?

If I generate numbers with th same seed always, but make two programs with differents compilers..... does I will obtein different numbers from both programs when executed?

thx.
Kempelen is offline   Reply With Quote
Old 07-02-2008, 01:01 AM   #2
Woof, woof!
 
zacs7's Avatar
 
Join Date: Mar 2007
Location: Australia
Posts: 3,292
Sounds pretty "homeworky".

I suggest you learn how they work, and that way you can answer all of your own questions. Not to mention you'll learn something http://www.eternallyconfuzzled.com/t..._tut_rand.aspx
__________________
"I.T. gets the chicky-babes" - M. Kelly
bakefile | vim
zacs7 is offline   Reply With Quote
Old 07-02-2008, 06:28 AM   #3
Code Goddess
 
Prelude's Avatar
 
Join Date: Sep 2001
Posts: 9,664
>if I generate numbers with the same seed always...... does I will
>obtein always the same numbers when executing my program?
Yes.

>If I generate numbers with the same seed, but run the program
>in different machine, does I will obtein the same numbers?
Perhaps. It depends on how you link to the random number generator. If it's dynamically linked and the different machine uses a different generator, you'll likely get a different sequence.

>If I generate numbers with th same seed always, but make two programs with differents
>compilers..... does I will obtein different numbers from both programs when executed?
Probably not, unless both compilers use the same algorithm or link to the same generator provided by the target system.
__________________
My best code is written with the delete key.
Prelude is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Criteria based random numbers alkisclio C++ Programming 6 09-14-2006 12:29 PM
calculating the variance of random numbers Unregistered C Programming 18 11-22-2004 08:16 AM
Generating Random Numbers FromHolland C++ Programming 6 06-16-2003 09:05 AM
Generate random numbers in Lucky7 project using C# Grayson_Peddie C# Programming 1 04-11-2003 11:03 PM
Help generating random numbers in MFC drb2k2 C++ Programming 3 04-08-2003 08:52 AM


All times are GMT -6. The time now is 12:41 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22