Home / Software / Computer programming / random number generation
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] - (Bottom) Print
Author Topic: random number generation  (Read 1921 times)
#groff -Tascii -man yakub
Topic Starter
Rookie



Posts: 44


« on: June 19, 2008, 06:09:59 AM »

i want a random number generation program between 0-5 using c language
IP logged
Sidewinder
Guru



Thanked: 97
Posts: 4,342

Experience: Familiar
OS: Windows 7

« Reply #1 on: June 19, 2008, 06:42:26 AM »

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.

 8)

As long as this thread is about wishlists, I want a Lamborghini Gallardo!

IP logged

If you don't know where you are going, any road will get you there

                                                                            -Lewis Carroll
#groff -Tascii -man yakub
Topic Starter
Rookie



Posts: 44


« Reply #2 on: June 19, 2008, 07:12:20 AM »

sorry i want an exact program
   i am not understanding anything from your given link
   thank you for your replay
IP logged
Sidewinder
Guru



Thanked: 97
Posts: 4,342

Experience: Familiar
OS: Windows 7

« Reply #3 on: June 19, 2008, 09:32:04 AM »

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.  8)
IP logged

If you don't know where you are going, any road will get you there

                                                                            -Lewis Carroll
HypercamJ
Beginner



Posts: 50

Oops =0

« Reply #4 on: June 19, 2008, 11:10:34 AM »

You really need a contract programmer.
Yo should sign up to be one.   ;)
IP logged

╔░░░░░░░░╗
_Hypercam⌡_
╚░░░░░░░░╝
Pages: [1] - (Top) Print 
Home / Software / Computer programming / random number generation « previous next »
 


Login with username, password and session length

Old Forum Search | Forum Rules
Copyright © 2010 Computer Hope ® All rights reserved.
Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC
Page created in 0.085 seconds with 20 queries.