Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include <string.h>
- #include <stdlib.h>
- void main(void)
- {
- int tries=0,total=0,sum2=0,items,chance,attempts,number,unique,sample,unique_obtained=0,obtained = 0;
- int i,j,k,l;
- int unique_greater=0,total_greater=0;
- printf("Please enter number of items to test: ");
- scanf("%d",&items);
- printf("What is the chance of item(1/#): ");
- scanf("%d",&chance);
- printf("How many kills/attempts: ");
- scanf("%d",&attempts);
- printf("Sample size: ");
- scanf("%d",&sample);
- printf("Current # of items: ");
- scanf("%d",&number);
- printf("# of unique items: ");
- scanf("%d",&unique);
- for(i=0;i<sample;i++)
- {
- total = 0;
- unique_obtained = 0;
- for(k=0;k<items;k++)
- {
- obtained = 0;
- for(j=0;j<attempts;j++)
- {
- l = !(rand()%chance);
- total = total + l;
- if(l)
- {
- obtained=1;
- }
- }
- unique_obtained = unique_obtained + obtained;
- }
- if(total>number)
- total_greater++;
- if(unique_obtained>unique)
- unique_greater++;
- }
- float q,r;
- q = total_greater/sample;
- r = unique_greater/sample;
- printf("%d obtained more drops than you\n",total_greater);
- printf("%d obtained more unique items than you\n", unique_greater);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement