sampling.jl
563 Bytes
neg(a) = islowercase(a) ? uppercase(a) : lowercase(a)
function sample(atoms)
result = Char[]
for a in atoms
if rand(Bool)
push!(result, rand(Bool) ? a : neg(a))
end
end
return length(result) > 0 ? join(result) : "λ"
end
function sample(n::Int, atoms)
result = String[]
for _ in 1:n
push!(result, sample(atoms))
end
return result
end
using DelimitedFiles
abc_atoms = [ 'a', 'b', 'c']
open("sample.csv", "w") do io
writedlm(io, [ "event" ])
writedlm(io, sample(100, abc_atoms), )
end