InterviewSolution
Saved Bookmarks
| 1. |
Solve : random number generation? |
|
Answer» i want a RANDOM number generation program between 0-5 using c language Quote i want a random number generation program between 0-5 using c language Have you CHECKED if C has a random number function? This link might be a little dense, but what CAUGHT my EYE was the KISS generator. As long as this thread is about wishlists, I want a Lamborghini Gallardo! sorry i want an exact program i am not understanding anything from your given link thank you for your replay You really need a contract programmer. This little bit of code will show you method, however it needs some CHANGES to meet your requirements. Code: [Select]#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int array[16] = {0}; int x; int y; int m; int n; srand(time(0)); for(x = 1; x < 17; x++) { array[x] = rand()%17; } for(x = 1; x < 17; x++) { for(y = 0; y < 17; y++) { if( x != y) { if(array[x] == array[y]) { array[x] = rand()%17; if(16 == array[x]) { array[x] == ' '; } } } } printf("%5d", array[x]); if(x%4 ==0) printf("\n"); system("PAUSE"); return 0; }} This program can be compiled with the Tiny C Compiler Good luck. Quote from: Sidewinder on June 19, 2008, 09:32:04 AM You really need a contract programmer.Yo should sign up to be one. |
|