How to set rand command, an integer from 3 to 50 (inclusive), but save it as a decimal number
alon4963
0
Newbie Poster
Recommended Answers
Jump to PostWhat have you tried so far?
Off the top of my head, I'd probably use two variables.
Call rand() and assign its output to an integer variable, say, temp_int.
Do a modulus operation on this variable: temp_int %= 50;
That should keep the variable's value to 50 or less.
Do …
All 2 Replies
Reply to this topic
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.