The chance to call, in percentage.
The function to call. It must be a void function.
The variadic argument passed to fun.
false if no luck.
uint cnt; bool test; void foo(uint param0, out bool param1) @safe { cnt += param0; param1 = true; } foreach(immutable i; 0 .. 100) pickAndCall!(double)(75.0, &foo, 1, test); assert(cnt > 25); assert(test); cnt = 0; test = false; foreach(immutable i; 0 .. 100) pickAndCall!(byte)(0, &foo, 1, test); assert(cnt == 0); assert(!test);
Calls a function according to a probability