# Note: this file intended for use in Julia - made in Jupyter using Gadfly using Distributions count = 10^3 inA = [] balls = 10^3 while (count >= 0) steps = 10^3 urnA = balls # initial number of balls in urn A urnB = 0 while (steps >= 0) if (rand(0:1) > 0) if (urnA > 0) urnA = urnA - 1 urnB = urnB + 1 else urnB = urnB - 1 urnA = urnA + 1 end else if (urnB > 0) urnA = urnA + 1 urnB = urnB - 1 else urnB = urnB + 1 urnA = urnA - 1 end end steps = steps - 1 end push!(inA, urnA) count = count - 1 end frequency = [] i = balls while (i >= 0) push!(frequency, i) i = i -1 end plot(x=inA, Geom.histogram(maxbincount = 25))