Created
          November 25, 2011 17:10 
        
      - 
      
- 
        Save nuryslyrt/1393989 to your computer and use it in GitHub Desktop. 
    random sayılar üretiyor.
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| int printRandomNumbers(int limit) { | |
| char status[limit]; | |
| int i, j, sayac, random, k; | |
| for(i = 0; i<limit; i++) | |
| status[i] = 'f'; | |
| sayac = limit; | |
| for(i=0;i<limit;i++) { | |
| random = rand()%sayac+1; | |
| k = 0; | |
| for(j=0;j<limit;j++) { | |
| if(status[j] == 'f') | |
| k++; | |
| if(k == random) break; | |
| } | |
| printf("%i\n", j); | |
| status[j] = 't'; | |
| sayac = sayac-1; | |
| } | |
| } | |
| int main(void) { | |
| char status[50]; | |
| char i, j; | |
| srand ( time(NULL) ); | |
| return printRandomNumbers(50); | |
| } | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment