use std::generate instead of custom loop

Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>