Should Raylib provide a function to generate random floats or doubles? #4636
Replies: 4 comments 2 replies
-
What exactly would be the API for a random double generator, including initiation and establishing boundaries? As a curiosity, what is an example of such usage in game development? |
Beta Was this translation helpful? Give feedback.
-
@barodapride I think it can be managed on user side with the already provided functions. |
Beta Was this translation helpful? Give feedback.
-
It can be managed on the user side but why not provide it out of the box? Here's what I'm doing. ` // Returns a random float between 0 and 1.0f (inclusive) // Returns a random float between min and max (inclusive) This generates a random float using the seed from Raylib since it's derived from GetRandomValue. You could say the 'resolution' of the float is limited by INT_MAX but practically speaking would anybody care about that? I would guess the vast majority of Raylib users would just use the Raylib provided function instead of implementing something different but I'm open to reasons why this would not be a good idea. |
Beta Was this translation helpful? Give feedback.
-
Because it adds a maintenance cost to raylib that I prefer to avoid. |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm just wondering why Raylib provides a method to get a random int but doesn't provide something similar for random floats or doubles.
I understand it might be easier to provide a random int based on a seed value but if there was a pull request for a random float generator that was solidly implemented would it get rejected? Providing a way to get random floats and doubles seems within the scope of Raylib given that it's so common in game development and Raylib already provides a way to generate random ints.
Beta Was this translation helpful? Give feedback.
All reactions