How to write a code for random pick from 1-1000 numbers?
The output should contain the 10 numbers from the range
1-1000 which should pick randomly, ie ,for each time we run
the code we should get different outputs.

Answer Posted / nischal e rao

The best way to solve this problem would be to create a hash
function and apply the current time to as the argument to
the hash function. the hash function should be designed to
return a number between 1 to 1000.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is queue in c?

765


When should the volatile modifier be used?

893


What is the difference between text and binary i/o?

783


What is %lu in c?

922


How can I access an I o board directly?

844


How can you read a directory in a C program?

894


What is the difference between int main and void main?

795


an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational

1080


What are the different types of control structures?

805


What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }

2269


What does emoji p mean?

795


What is array of pointers to string?

803


What is advantage of pointer in c?

925


Why does notstrcat(string, "!");Work?

893


a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

993