On Monday, 22 August 2016 at 17:13:10 UTC, jmh530 wrote:
On Monday, 22 August 2016 at 15:34:47 UTC, Seb wrote:
Hey all,

I am proud to publish a report of my GSoC work as two extensive blog posts, which explain non-uniform random sampling and the mir.random.flex package (part of Mir > 0.16-beta2):


Thanks for the well-done blog posts, especially the first one.

I am glad to hear this!

Does your implementation make any use of CTFE?

If you refer to whether the intervals can be calculated at CT, unfortunately it can't be used due to four main reasons:

- FP-math at CT (it's already hard to deal with at RT, see e.g. my recent complaint [1]) - the problem is that the Flex algorithm is very sensitive to numerical errors and thus an erroneous change at the lowest end (e.g 10^-15) can lead to totally different numbers with a seeded random engine - std.container due to pointers (I doubt this can/will be fixed in the near future) - std.math due to inline assembly and other tricks (this can be fixed and I will submit a couple of PRs soon)
- speed of the CTFE engine (see e.g. [2] for std.regex)

That being said CTFE is of course used to compute mixins, constants and specialize functions. Moreover thanks to all speed-ups described in the second blog, constructing the intervals takes about 0.1ms, so for the majority of the users it shouldn't even be noticeable and for the tiny minority it does, they can still manually inline the intervals.

[1] http://forum.dlang.org/post/hjaiavlfkoamenido...@forum.dlang.org [2] http://forum.dlang.org/post/iqcrnokalollrejca...@forum.dlang.org

Reply via email to