Home » U++ Library support » U++ Core » random functions proposal
Re: random functions proposal [message #35160 is a reply to message #35159] |
Tue, 17 January 2012 20:25 |
|
Sender Ghost wrote on Tue, 17 January 2012 20:08 |
Well, what I "proposed" (and I didn't propose, but just showed a simple solution) is useful for float numbers, not double, hence this Randomf, instead of Randomd, I think.
With qword Random64(qword n) it will be possible to do the same, of course.
mirek wrote on Tue, 17 January 2012 14:24 | ...but it looks like int64 -> double conversion is CPU opcode, so perhaps Random64(int n) as prerequisite, than Randomf() is a good path...
|
According to "Random number generators discussion" it is possible to combine two random dword values (MAKEQWORD macro might be useful here) to get random qword value.
|
The type doesn't really matter, I referred to "float" just as a sloppy abbreviation for "floating point type". The problem is that even with qword the simple division will not generate uniform distribution because floating point numbers are not equally spaced (as is explained in the document I linked to).
Honza
|
|
|
Goto Forum:
Current Time: Sat May 04 15:28:40 CEST 2024
Total time taken to generate the page: 0.02719 seconds
|