Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Osa11_08.Lottoarvonta #146

Open
JuhaML opened this issue Oct 28, 2019 · 0 comments
Open

Osa11_08.Lottoarvonta #146

JuhaML opened this issue Oct 28, 2019 · 0 comments

Comments

@JuhaML
Copy link

JuhaML commented Oct 28, 2019

Lottoarvonta elävässä elämässä lienee enempi tämäntapainen:

    public void arvoNumerot() {
        this.numerot = new ArrayList<>();
        ArrayList<Integer> pallot = new ArrayList<>();
        pallot.addAll(Arrays.asList(Lottorivi.PALLOT));
        Collections.shuffle(pallot);
        while (this.numerot.size() < 7) {
            this.numerot.add(pallot.remove(pallot.size() - 1));
        }
    }

Lukujen arpominen välillä [1-40] ja toistuvien numeroiden hylkääminen kunnes saadaan 7 arvoa ei ihan vastaa oikeaoppista tapaa muodostaa kombinaatioita - pois otettua lottopalloa kun ei enää pyöritellä uudelleen samassa arvonnassa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant