Seven-sided dice from five-sided dice: Difference between revisions

Content added Content deleted
(Added zkl)
(add julia example. Not complete (no testing))
Line 958: Line 958:
6 142648
6 142648
7 142619 </pre>
7 142619 </pre>

=={{header|Julia}}==
<lang Julia>dice5() = rand(1:5)
function dice7()
r = int((dice5()+5dice5()-3)/3)
r>7 ? dice7() : r
end</lang>
{{Out}}
<pre>julia> show([dice5() for i=1:20])
[1,4,3,2,4,1,1,5,4,2,3,5,5,3,2,4,2,4,4,2]

julia> show([dice7() for i=1:20])
[3,2,6,7,5,6,4,4,6,6,7,2,6,3,2,7,5,2,1,3]</pre>


=={{header|Lua}}==
=={{header|Lua}}==