Generate ======== Include :file:`` .. cpp:namespace:: mln .. cpp:function:: template void generate(OutputImage out, Generator g) Assigns each value in the image with a value generated by the given function object `g`. This is equivalent to the following code:: for (auto& vout : out.values()) vout = g(); :param out: The output image. :param g: The value generator. :tparam OutputImage: A model of :cpp:concept:`OutputImage` :tparam Generate: A model of :cpp:concept::`std::Generator` Examples -------- #. Generate random values in the image: std::default_random_engine e1(r()); std::uniform_int_distribution g; mln::image2d ima(10, 10); mln::generate(ima, g); Complexity ---------- Linear in the number of pixels.