@jroid8 to Programmer [email protected] • 1 year agoknow the features of your languageimagemessage-square144arrow-up1647arrow-down123
arrow-up1624arrow-down1imageknow the features of your language@jroid8 to Programmer [email protected] • 1 year agomessage-square144
minus-square@[email protected]linkfedilink17•1 year agoLoads of beginners in this thread. Here’s how it’s done in the industry. The code: return a; The test: a = rand()%100+1; It works, boss.
minus-squareunalivejoylinkfedilinkEnglish4•edit-21 year agoThis must be a custom random function, because it’s standard for random to return a float between 0-1 exclusive. Maybe you meant to multiply by 100 instead of modulo.
minus-square@[email protected]linkfedilink10•1 year agoI think for once I didn’t fuck up. https://cplusplus.com/reference/cstdlib/rand/
minus-square@Snazzlink5•1 year agoYou guys are talking about two different things. Random integer vs random float
Loads of beginners in this thread. Here’s how it’s done in the industry.
The code:
The test:
It works, boss.
This must be a custom random function, because it’s standard for random to return a float between 0-1 exclusive. Maybe you meant to multiply by 100 instead of modulo.
I think for once I didn’t fuck up.
https://cplusplus.com/reference/cstdlib/rand/
You guys are talking about two different things. Random integer vs random float