Thread: C statist

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    C statist


    Hello (sorry for my bad English)
    I must write program who shows for users statistics.
    I make 1 or more random where i roll 6 numbers and save it to file.(numbers are in the range 1 to 60)
    How to show which two , three and four numbers form every one roll exist most frequently.
    for example,
    first roll
    1,22,32,42,55,60
    second roll
    2,4,5,32,55,42
    third
    1,2,60,32,42,55
    Most frequently pair of two number is (32,44) or three (32,42,55) and four is (32,42,55,60)
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,162
    Rep Power
    2222
    You will use rand() to get a pseudo-random number. When your program starts, you will use srand() to feed the pseudo-random-number generator a seed value. If you use the same seed value, you will get the same sequence of pseudo-random numbers. If you want it to be "really random", then you would need to feed it a different number each time you run it, such as time().

    Google and you will find many discussions and examples. At least now you have some function names to use in your search.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0
    OK now when I run program i get other numbers them last time. But still i do not know how check most frequently pairs of two number three and four.

IMN logo majestic logo threadwatch logo seochat tools logo