StudioCherno / Walnut

Walnut is a simple application framework for Vulkan and Dear ImGui apps
MIT License
1.99k stars 367 forks source link

Random float problem in some compiler or platform #37

Open WeebOwO opened 1 year ago

WeebOwO commented 1 year ago

1. Describe the bug

In some compiler or platform, std::mt19937::result_type will not be unsigned int, this will cause Float() not in 0~1 range. https://github.com/TheCherno/Walnut/blob/3b8e414fdecfc6c8b58816106fe8d912bd172e31/Walnut/src/Walnut/Random.h#L48

图片

图片

2. Desktop

3. My fix solution

explicit declare type like below

 static std::uniform_int_distribution<uint32_t> s_Distribution;