I have a program that uses blocking/non-blocking direct and indirect communication. I need to have it randomly choose whether or not it should do the blocking or non-blocking method and I do not know how. Does anyone have any suggestions? Thank you.

Recommended Answers

All 2 Replies

Hi everyone,

You can use the Math class. They have a random method there. Once you get the random number pass the number in an if else statement with your own defined ranges.

For my own info why are you randomly choosing communication blocking??

Richard West

Because my assignment requires me to. We have to show blocking and non-blocking direct communication and blocking and non-blocking indirect communication. But, it has to randomly choose between blocking and non-blocking for both direct and indirect communication. Thanks for the input.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.