I tried what you siad but it doesn't work. It is possible to give a working little example of using short arguments and controlled its value to be only between 1 and 1000 no matter what is the value of the arguments?
I'm so lost right now. BTW, if I transform my short into int, I get the same problem because if i go over limit i will have the same problem. I will give a int over 1000 but still be between 1 and 1000 for Java.
User Profile
Collapse
-
How to avoid this problem?
I have an object receiving a short in argument. This argument is a code for a product and I want this number to be only between 1 and 1000.
If I do this:
Class a = new Class((short)96 5);
System.out.prin tln(a.getArgume nt());
This will return 965 as supposed
Class a = new Class((short)12 00);
System.out.prin tln(a.getArgume nt());
This will cause my exception to pop... -
I was unterstanding up to this point perfectly. I just want to make use I get it before asking for more explanation.
Let's say my hand is:
Hand (suit - strenght):
Card1 : 2 - 4.
Card1 : 2 - 6.
Card1 : 2 - 8.
Card1 : 2 - 9.
Card1 :2 - 11.
For checking if my hand is a flush, my method should look ike this:
// ss = result of the checking.
// s = the...Leave a comment:
-
But Randomizing the seed doesn't makes the Random numbers really Random though because Math.Random() will never be "Pure" Random. Am I correct?
P.S. Maybe too much Random in that sentence :)...Leave a comment:
-
I was probably smooking that day. I correct that really dumb answer and this is my results after 50 millions hands. The results are as bad but reversely:
Nombre de mains généré : 50000000
Straight Flush : 0.0011 % In theory : 0.0012%
Four Of A Kind : 0.0354 % In theory : 0.0240%
Full House : 0.1419 % In theory : 0.1441%
Flush : 0.2264 % In theory : 0.1967%...Leave a comment:
-
Theory almost never matched in practice.
By doing a test with 50 millions hands, I should have a really accurate result...specia ly with isFourOfAKind() because I have only 5 cases (XOOOO, OXOOO, OOXOO, OOOXO, OOOOX).Leave a comment:
-
Trying to get more precise number (Poker Hands Generator)
Hello Everyone,
I did a poker program in Java that essencially finds the strenght of a poker hand created Randomly. My program is doing OK...but I'm pretty sure it can be optimised.
This is my results with 1 million hands:
Number of hands generated : 1000000
Straight Flush : 0.0012 % In theory : 0.0012%
Four Of A Kind : 0.017 % In theory : 0.0240%...
No activity results to display
Show More
Leave a comment: