Search Issue Tracker
Fixed
Fixed in 1.2.0
Votes
0
Found in [Package]
1.2.0
Issue ID
BUR-2370
Regression
No
Burst: Random generation fails for float when using byte parameters
1. What happened
The random generation using "Unity.Mathemenatic.Random" generates values out of the supplied boundaries when enabling Burst compilation. The code works as expected using Mono runtime only.
2. How can we reproduce it using the example you attached
Open the project and start the playmode in editor ensuring burst compilation is enabled. The log will be spammed with error messages like the following:
Random generated float not within specified bounds. Generated number is 2326946000
Expected is a float value between -2 and 2. These are the min/max parameters which are specified for the random.NextFloat call. But the returned value seems like an integer number not a float. So followup code works not as desired.
3. Additional info
Excplicitly casting the byte parameters to float solves the issue. Still this should be fixed, because it works in Mono just fine.
Notes:
- Related Forum Thread: [https://forum.unity.com/threads/in-40909-random-generation-fails-for-float-when-using-byte-parameters.1435885/|https://forum.unity.com/threads/in-40909-random-generation-fails-for-float-when-using-byte-parameters.1435885/]
- Mathematics 1.2.6 is not available to be chosen in Jira, choosing the closest version to it
- Testing by CQA was not done as per request of Developers
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
- Crash on MemoryManager::Deallocate when rapidly calling Addressables.LoadAssetAsync
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
- [Rendering Debugger] [NewInputSystem] Debug Overlays in Play mode throws InvalidOperationException when using New Input System
Resolution Note (fix version 1.2.0):
This is fixed in 1.8, as we don't support Burst 1.2 anymore