如何发送由绑定创建的功能对象到 function/method?

How to send functional object, created by bind to function/method?

我已经为随机化需求创建了一个功能对象。

我只是不知道如何在没有模板的情况下将它发送到 function/methods。 有他们很简单,就

template <typename T>
void FooTemplate (T rand)
{
   int b = rand(); // OK
}

void foo (... ?)
{
 int a = rand(); // how to send generator to function?
}

int main(int argc, char* argv[])
{
auto rand = std::bind(std::uniform_int_distribution<uint32_t>{20, 30}, std::default_random_engine{ std::random_device()() });
return 0;
}
void foo(std::function<int()> rand) {...}

std::function<int()> 将包装任何可调用对象,包括由 std::bind

制造的调用对象