Skip to content

Instantly share code, notes, and snippets.

@christophergandrud
Last active February 21, 2021 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christophergandrud/1fb1183a3ee1a3a1154001999871d65f to your computer and use it in GitHub Desktop.
Save christophergandrud/1fb1183a3ee1a3a1154001999871d65f to your computer and use it in GitHub Desktop.
"""
ebt_sampler(total_questions::Int = 310)
Create question set to practice for the Deutscher Einbürgerungstest.
The official question set can be found at: <http://oet.bamf.de/pls/oetut/f?p=514:1:329473569276328:::::>.
The question set has 310 questions, but who knows, maybe this could change.
Adjust the total question set with `total_questions::Int`.
"""
function ebt_sampler(total_questions::Int = 310)
i::Int = -9; u::Int = 0
out = zeros(Int, 0)
while u < total_questions
i += 10; u += 10
if u == total_questions
x = StatsBase.sample(i:u, 3, replace = false)
else
x = StatsBase.sample(i:u)
end
out = append!(out, x)
end
return(out)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment