Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
January 22nd, 2013, 03:31 PM
 Ediks
Registered User

Join Date: Jan 2013
Posts: 2
Time spent in forums: 38 m 31 sec
Reputation 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
January 22nd, 2013, 03:48 PM
 dwise1_aol
Contributing User

Join Date: Jan 2003
Location: USA
Posts: 6,837
Time spent in forums: 3 Months 20 h 49 m 35 sec
Reputation Power: 2199
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.

#3
January 22nd, 2013, 04:26 PM
 Ediks
Registered User

Join Date: Jan 2013
Posts: 2
Time spent in forums: 38 m 31 sec
Reputation 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.

 Viewing: Dev Shed Forums > Programming Languages > C Programming > C statist