Random sentence from book: Difference between revisions
m
→{{header|Julia}}
Line 15:
=={{header|Julia}}==
<lang julia>""" weighted random pick of items in a Dict{String, Int} where keys are words, values counts """
function weightedrandompick(
n = rand(1:total)
for key in keys(
n -=
if n <= 0
return key
Line 76:
end
end
followsums =
follow2sums =
afterstopsum = sum(values(afterstop))
|