rand() to choose?

This is a discussion on rand() to choose? within the C++ Programming forums, part of the General Programming Boards category; If I have a function like select(int a, int b, int c) how can I use the rand() to select ...

rand() to choose?

If I have a function like select(int a, int b, int c) how can I use the rand() to select a, b or c and then return that value? ie.. if a=30, b=40 and c=50 how can i use rand() to just pick b and return 40 back out? And then the next time i call the function, if c=45 use rand() to pick c that time and return 45?

So, in other words, I only need rand() to randomly pick either a, b or c and then return it. I know that the faq shows how to use rand to generate an actual value but thats not what I need for this. Thanks for any help.