1. ## random number

input: 8 numbers
output:a random number between 1-100 base on the input numbers
any idea for doing this ?

2. Post some code first. As far as the random number goes, read this SRAND - set seed for random number generation.

3. i know how s rand and rand work but if i use them its not base on the numbers!
i want the program choose random numbers in some rule
for example if more than half of numbers are lower than 1000 the chance for give output numbers that are lower than 50 increese by 20 percent or sth like this!

4. Why?

Anyway, here's an approach. (Why anyone would use it rather than a direct rand() value is beyond me though)

Code:
```int randbased(input *array) // input is in array[0] to array[7]
{
int k, s = 0;
for (k = 0; k < 8; k++) s += input[k];
for (k = 0; k < s; k++) rand(); /* ignore s random numbers */
return rand();
}```

5. Originally Posted by king_zart
i want the program choose random numbers in some rule
We are neither telepathic nor omniscient, you know.

You need to define those rules for us to be able to help you.

If you don't know the rules, but can show a complete set of inputs and outputs, then we can help you deduce the rules. Then we can help you implement those rules in code. But we cannot divine your wishes.

Please be specific, as vague partial examples are just frustrating to everyone. We need detailed, specific information, to help you.

6. Originally Posted by king_zart
input: 8 numbers
output:a random number between 1-100 base on the input numbers
any idea for doing this ?
Yes hundreds of ideas in fact.
E.g CRC + LCG PRNG + MOD.
Just write some code that does something. Anything you can do, no matter how simple it is to begin with, would be great.

7. as i said before i want the program do this...
Code:
```#include <stdio.h>
int main()
{
int a[8];
int i,b;
for(i=0;i<8;i++)
scanf("%d",&a[i]);
for(i=0;i<8;i++)
if(a[i]<100)
b++;
if(b>4)
//give a random number lower than 200 that its chance for become lower than 100 is 2times more than becom higher than 100
{}
}```

8. Generate a random number between 0 and 300.
If it is greater or equal to 200, subtract 200, getting a new number between 0 and 100.

Result: numbers between 0 and 100 are twice more likely to come up than numbers between 100 and 200.