Question about random numbers

This is a discussion on Question about random numbers within the C Programming forums, part of the General Programming Boards category; if I generate numbers with the same seed always...... does I will obtein always the same numbers when executing my ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    145

    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.

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    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

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Criteria based random numbers
    By alkisclio in forum C++ Programming
    Replies: 6
    Last Post: 09-14-2006, 01:29 PM
  2. calculating the variance of random numbers
    By Unregistered in forum C Programming
    Replies: 18
    Last Post: 11-22-2004, 08:16 AM
  3. Generating Random Numbers
    By FromHolland in forum C++ Programming
    Replies: 6
    Last Post: 06-16-2003, 10:05 AM
  4. Generate random numbers in Lucky7 project using C#
    By Grayson_Peddie in forum C# Programming
    Replies: 1
    Last Post: 04-12-2003, 12:03 AM
  5. Help generating random numbers in MFC
    By drb2k2 in forum C++ Programming
    Replies: 3
    Last Post: 04-08-2003, 09:52 AM

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