|
![]() |
Junilu Lacar wrote:Also, try using the java.util.Random class instead of Math.random
Don't know about the algorithm, but Joshua Bloch suggests that shuffle() isn't random enough for 52 cards. Can't remember whether it is in Effective Java or Java Puzzlers, but it sounds more likely to be the latter.Junilu Lacar wrote:. . . I believe the Collections.shuffle() algorithm actually does that under the covers for you. . . .
matthew reid wrote:thanks for the advice. the only reason i had lots of lists filled with random numbers and then taken random numbers from the list was hoping to make it more random.
im in the process of following your advice. i'v only used array lists once and never used collections. so im still trying to understand it all but im getting there.
i'll keep you updated on my process.
Campbell Ritchie wrote:(...)
There are three kinds of actuaries: those who can count, and those who can't.
Lots of people think Streams are an advanced feature of the language, but I am not convinced. I think that the simpler uses of Streams are probably a basic form of programming in Java8. It won't work in Java7.matthew reid wrote:. . . never even touched on anything have you just told me before. . . .
matthew reid wrote:hey everybody, i haven't had time to read all those posts yet but finished making a simplified version based on what Junilu Lacar told me. it is much more simple.
matthew reid wrote:anyone know any good websites to learn from. i need more then just reading about the code and more about how it is actually used in a program
matthew reid wrote:wow Junilu Lacar there is now way i could have done that. i havent learnt any of that at all yet.
i normally write using methods but i could figure how to put the array list into the method.
All things are lawful, but not all things are profitable.
matthew reid wrote:my problems is i, at first normally over complicate things.
Knute Snortum wrote:
i normally write using methods but i could figure how to put the array list into the method.
Assuming you meant "couldn't" (I do that all the time, by the way) here is how you would pass an ArrayList (or anything) into a method:
As an alternative, if you hover your mouse on the red underlining or click the red mark on the left, you will probably get a list of possible corrections including spelling corrections.Junilu Lacar wrote:. . . IDEs that have code completion will help you avoid these kinds of problems. . . .
There is of course a good scientific explanation for that; once you have found the lost article, you stop looking in other places. Once you have found a really good design you will stop looking for other designsJunilu Lacar wrote:. . . "You'll always find what you're looking for in the last place you look." . . . your best design is the last one you try.
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
|