Pick random element: Difference between revisions
Content deleted Content added
m Added C implementation |
D language entry added |
||
Line 15: | Line 15: | ||
return 0; |
return 0; |
||
}</lang> |
|||
=={{header|D}}== |
|||
<lang D>import std.stdio, std.random; |
|||
void main() { |
|||
auto items = ["foo", "bar", "baz"]; |
|||
auto r = items[uniform(0, items.length)]; |
|||
writeln(r); |
|||
}</lang> |
}</lang> |
||