Random Numbers and Removing only 1 item at a time

D

deanfamily

I have a double-linked list. I need to insert RANDOM numbers into it. The
rand() function doesn't put "random" number in the list, in the sense that
every time you run the program it should produce new numbers. Also, I need
to know if it is possible to remove just one of an item, instead of all that
match the given criteria with the remove command. Any thoughts?
 
M

Marcus Kwok

deanfamily said:
I have a double-linked list. I need to insert RANDOM numbers into it. The
rand() function doesn't put "random" number in the list, in the sense that
every time you run the program it should produce new numbers.

Are you seeding the random number generator? Look up srand().
 
D

deanfamily

Marcus Kwok said:
Are you seeding the random number generator? Look up srand().

I didn't know of that until you mentioned it, but I just implemented it in
my code, and it works just fine. Thanks for the idea.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top