0

How do I generate random numbers in C? The user doesn't enter anything, I'm just looking for a way to generate random numbers every time I run the program.

Thanks guys!

6
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by Chilton
0

How do I generate random numbers in C? The user doesn't enter anything, I'm just looking for a way to generate random numbers every time I run the program.

Thanks guys!

I would lookup random or srandom...for pseudo random functions in C

0

You could use rand() or srand() for it. Read the manual in google for the details.

0

How do I generate random numbers in C? The user doesn't enter anything, I'm just looking for a way to generate random numbers every time I run the program.

Thanks guys!

"srand()/rand()" isn't exactly the most sophisticated random number generator in the world, but it *should* work for your purposes.

0

>I would lookup random or srandom...for pseudo random functions in C
Neither of which are standard functions, meaning unless the OP has the same compiler you do, the chances of your suggestion working are somewhat slim. srand and rand are the standard functions for seeding and generating random numbers.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.