I want the Random to return the same values each time. So I tried giving it a const seed. But it still returns random values. How can I stop this?
EDIT: I use the same Random object all over my code, The first time I tested my program I got the following values from the random:
13, 9, 10, 12, 14, 11, 15, 10, 8, 6, 12, 9, 7, 7, 6, 1, 0, 0, 0, 80, 33, 3, 0, 45, 6, 2, 51, 50, 3, 0, 1, 1, 0, 2, 3, 0, 0, 2, 0, 3, 0, 1, 33, 1, 22, 7, 55, 92, 33, 1, 5, 6, 10, 2, 1, 85, 26, 1, 3, 42, 16, 0, 2, 34, 0, 1, 2, 8, 0, 73, 1, 4, 66, 59, 49, 99, 2, 4, 97, 57, 85, 28, 0, 2, 3, 9, 36, 1, 19, 4, 0, 71, 9, 2, 3, 76, 6, 3, 0, 96, 84, 22, 0, 0, 1, 1, 0, 1, 0, 0, 2, 0, 0, 0, 0, 58, 2, 1, 2, 1, 0, 1, 5, 0, 0, 1, 0, 4, 21, 59, 3, 1, 6, 3, 6, 0, 0, 3, 2, 2, 3, 5, 3, 0, 6, 5, 60, 3, 4, 4, 2, 6, 1, 3, 5, 1, 5, 26, 4, 0, 25, 5, 0, 61, 2, 0, 29, 2, 1, 34, 57, 55, 61, 1, 1, 21, 6, 1, 3, 0, 56, 6, 23, 6, 0, 47, 1, 1, 55, 0, 0, 5, 1, 4, 0, 57, 21, 45, 2, 0, 3, 0, 6, 1, 64, 39, 2, 0, 51, 31, 13, 9, 10, 12, 14, 11, 15, 10, 8, 6, 12, 9, 7, 7, 6, 1, 0, 0, 0, 80, 33, 3, 0, 45, 6, 2, 51, 50, 3, 0, 1, 1, 0, 2, 3, 0, 0, 2, 0, 3, 0, 1, 33, 1, 22, 7, 55, 92, 33, 1, 5, 6, 10, 2, 1, 85, 26, 1, 3, 42, 16, 0, 2, 34, 0, 1, 2, 8, 0, 73, 1, 4, 66, 59, 49, 99, 2, 4, 97, 57, 85, 28, 0, 2, 3, 9, 36, 1, 19, 4, 0, 71, 9, 2, 3, 76, 6, 3, 0, 96, 84, 22, 0, 0, 1, 1, 0, 1, 0, 0, 2, 0, 0, 0, 0, 58, 2, 1, 2, 1, 0, 1, 5, 0, 0, 1, 0, 4, 21, 59, 3, 1, 6, 3, 6, 0, 0, 3, 2, 2, 3, 5, 3, 0, 6, 5, 60, 3, 4, 4, 2, 6, 1, 3, 5, 1, 5, 26, 4, 0, 25, 5, 0, 61, 2, 0, 29, 2, 1, 34, 57, 55, 61, 1, 1, 21, 6, 1, 3, 0, 56, 6, 23, 6, 0, 47, 1, 1, 55, 0, 0, 5, 1, 4, 0, 57, 21, 45, 2, 0, 3, 0, 6, 1, 64, 39, 2, 0, 51, 31
The second time I got:
13, 9, 10, 12, 14, 11, 15, 10, 8, 6, 12, 9, 7, 7, 6, 1, 0, 0, 0, 2, 1, 1, 3, 1, 0, 33, 9, 61, 1, 2, 54, 59, 99, 28, 0, 88, 11, 0, 0, 92, 24, 0, 47, 43, 83, 13, 1, 1, 53, 46, 22, 0, 2, 0, 0, 0, 0, 2, 0, 13, 8, 1, 16, 6, 2, 34, 0, 1, 2, 8, 0, 73, 1, 4, 66, 59, 49, 99, 2, 0, 97, 57, 85, 28, 5, 2, 3, 3, 36, 4, 19, 0, 0, 71, 9, 2, 3, 76, 6, 0, 0, 0, 2, 4, 2, 0, 1, 0, 1, 1, 0, 0, 0, 2, 6, 1, 58, 2, 1, 2, 1, 0, 1, 5, 0, 0, 0, 0, 4, 21, 59, 3, 1, 6, 3, 6, 0, 0, 3, 2, 2, 3, 5, 3, 0, 6, 5, 60, 3, 4, 4, 2, 6, 1, 3, 5, 1, 5, 26, 4, 0, 25, 5, 0, 61, 2, 0, 29, 2, 1, 34, 57, 55, 61, 1, 1, 21, 6, 1, 3, 0, 56, 6, 23, 6, 0, 47, 1, 1, 55, 0, 0, 5, 1, 4, 0, 57, 21, 45, 2, 0, 13, 9, 10, 12, 14, 11, 15, 10, 8, 6, 12, 9, 7, 7, 6, 1, 0, 0, 0, 2, 1, 1, 3, 1, 0, 33, 9, 61, 1, 2, 54, 59, 99, 28, 0, 88, 11, 0, 0, 92, 24, 0, 47, 43, 83, 13, 1, 1, 53, 46, 22, 0, 2, 0, 0, 0, 0, 2, 0, 13, 8, 1, 16, 6, 2, 34, 0, 1, 2, 8, 0, 73, 1, 4, 66, 59, 49, 99, 2, 0, 97, 57, 85, 28, 5, 2, 3, 3, 36, 4, 19, 0, 0, 71, 9, 2, 3, 76, 6, 0, 0, 0, 2, 4, 2, 0, 1, 0, 1, 1, 0, 0, 0, 2, 6, 1, 58, 2, 1, 2, 1, 0, 1, 5, 0, 0, 0, 0, 4, 21, 59, 3, 1, 6, 3, 6, 0, 0, 3, 2, 2, 3, 5, 3, 0, 6, 5, 60, 3, 4, 4, 2, 6, 1, 3, 5, 1, 5, 26, 4, 0, 25, 5, 0, 61, 2, 0, 29, 2, 1, 34, 57, 55, 61, 1, 1, 21, 6, 1, 3, 0, 56, 6, 23, 6, 0, 47, 1, 1, 55, 0, 0, 5, 1, 4, 0, 57, 21, 45, 2, 0
The first couple of values are quite similar but the rest. Well, you can see
I use private static Random r = new Random(SEED); // The seed is never changed after this point I also use this random to randomize byte arrays. The thing is, I'm getting different outputs for the same input. I wish I could post more code but it's a really big project to post here.