Simple random generator
Extra typenames

Every place you use typename, it's unnecessary. std::enable_if_t will take care of that for you.

thread_local

First of all, thread_local implies static, so writing both is redundant. Secondly, if you're making it thread_local, that's effectively like making a thread-specific singlelton - so you should return a reference to it, not a copy:

template&lt;class T = std::mt19937, std::size_t N = T::state_size&gt;
auto randomEngine() -&gt; std::enable_if_t&lt;!!N, T&amp;&gt;


And take it by reference:

static auto&amp; RandomEngine = randomEngine();


random()

I'm not sure it's a good idea to create the distribution every time. The distribution object itself can keep state, so I think it'd be a better idea to take it in instead:

template &lt;class Dist&gt;
typename Dist::result_type random(Dist&amp; dist)
{
    static auto&amp; RandomEngine = randomEngine();
    return dist(RandomEngine);
}


And alter dist&lt;T&gt; to take arguments so that you could do:

auto d = dist&lt;unsigned&gt;(0, 15);
for (auto i = 0u; i &lt; 16; ++i) 
    std::cout &lt;&lt; random(d) &lt;&lt; ' ';