+ 1
How to generate random decimal numbers
Doesn't look like Random.Next() has the option to generate decimals apart from integers Any answer is appreciated 😉
15 Respuestas
+ 4
Lisa
Your method works perfectly fine 👍
https://code.sololearn.com/c2XaDFdrsLop/?ref=app
+ 3
Why not generate integers and then divide them? Can you specify what sort of numbers you want?
edit:
what did you try to google? "cs random decimals" got me this:
https://stackoverflow.com/questions/609501/generating-a-random-decimal-in-c-sharp
+ 3
Martin Taylor, thanks for the formatting too 😉, didn't know you could do :F after a number
+ 3
This thread is about generating random numbers in C#, not about Lua or playground or web. So what does ChillPill's Lua demo do here?
+ 2
Just out of curiosity: What do you need the random decimals for? (And actual decimals or just some floating point number type?)
+ 2
Lisa
Any decimal that's not an integer, couldn't come up with a better term so my apologies for making it confusing.
+ 2
Thank you, Martin Taylor
+ 2
How is the lua code related to the question of this thread? Please don't post non-related codes.
+ 1
Thanks, just trying to find something new, the method Lisa came up with is very clever and the link she provided is mind boggling 👍
+ 1
Lisa
And I needed them to display the possibility of chosen items, the output should look like this:
first - 42.5%
second - 57.5%
... maybe even more depending on the amount
Not sure how to implement it properly though
+ 1
Thank you, Martin Taylor, what is the use of ⚡decimal numbers in the program.📜
+ 1
This is only for the sololearn code playground ⚡⚡
- 1
Lua playground :- 🏜
https://code.sololearn.com/WxU9RRnc2jnT/?ref=app