There is no inaccuracy and therefore no randomness.
Just like the integers are an approximation for real numbers, the same can be said for floating point numbers. The distribution of floating point numbers across the reals is even in logarithmic space in the same way that the distribution of integers is even in real space.
When you write a number like 1.234
and assign that to a double
, the closest double
to 1.234
is picked. This is different to assigning that to an int
where the nearest int
towards 0 is picked. But the principle is the same.
When you compute nump / 10;
, floating point standards (e.g. IEEE754) often require that the closest double
to the result is picked.
If you need pseudo-random numbers then use appropriate functions that are part of the C++ standard library.
If you want true random numbers, and are very rich, then you can acquire some hardware for generating them, else you can use someone else's hardware: e.g. https://qrng.anu.edu.au/