Lottery machine using multi-threading