hello , how can i randomize float or decimal value ?
example : 1.36 , 2.65
how can i randomize float value ?
- skinkairewalker
- Enthusiast
- Posts: 637
- Joined: Fri Dec 04, 2015 9:26 pm
Re: how can i randomize float value ?
Code: Select all
Debug Random(999, 100) / 100.0
Re: how can i randomize float value ?
If you really want excatly 2 decimals:
But only as string
Code: Select all
Debug StrD(Random(999, 100) / 100.0, 2)
Re: how can i randomize float value ?
Code: Select all
Procedure.f RandomFloat(Maximum.f = 1.0, Minimum.f=0.0)
ProcedureReturn (Maximum-Minimum) * 4.6566128752457969241e-10 * Random(2147483647) + Minimum
EndProcedure
Code: Select all
RandomSeed(5)
Debug RandomFloat()
Debug RandomFloat(100.0)
Debug RandomFloat(1, -1)
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module