Skip to content

Instantly share code, notes, and snippets.

@marvk
Created August 19, 2019 10:35
Show Gist options
  • Save marvk/1e4d1b52808ea4d10c9267350a4cecb2 to your computer and use it in GitHub Desktop.
Save marvk/1e4d1b52808ea4d10c9267350a4cecb2 to your computer and use it in GitHub Desktop.
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
17 0
18 0
19 0
20 0
21 0
22 0
23 0
24 0
25 0
26 0
27 0
28 0
29 3
30 10
31 18
32 49
33 117
34 289
35 870
36 2132
37 4871
38 10661
39 22759
40 47678
41 96109
42 185234
43 344093
44 616523
45 1068851
46 1787520
47 2895438
48 4521414
49 6830743
50 9975499
51 14074633
52 19221110
53 25383500
54 32439521
55 40115862
56 47999215
57 55561696
58 62271749
59 67553831
60 70921895
61 72094442
62 70930140
63 67545055
64 62263807
65 55556078
66 47990930
67 40114077
68 32436748
69 25387928
70 19230591
71 14079337
72 9975411
73 6831951
74 4525876
75 2894879
76 1788632
77 1069992
78 616882
79 342165
80 185536
81 95860
82 47862
83 23150
84 10641
85 4726
86 2016
87 830
88 353
89 129
90 53
91 18
92 6
93 5
94 1
95 0
96 0
97 0
98 0
99 0
100 0
101 0
102 0
103 0
104 0
105 0
106 0
107 0
108 0
109 0
110 0
111 0
112 0
113 0
114 0
115 0
116 0
117 0
118 0
119 0
120 0
121 0
122 0
123 0
124 0
125 0
126 0
127 0
128 0
import java.util.UUID;
class Scratch {
public static void main(String[] args) {
final UUID uuid = UUID.randomUUID();
final int[] result = new int[129];
for (int i = 0; i < 1_000_000_000; i++) {
final UUID current = UUID.randomUUID();
final int i1 = Long.bitCount(uuid.getLeastSignificantBits() ^ current.getLeastSignificantBits());
final int i2 = Long.bitCount(uuid.getMostSignificantBits() ^ current.getMostSignificantBits());
final int i3 = i1 + i2;
result[i3] += 1;
}
for (int i = 0; i < result.length; i++) {
System.out.println(i + " " + result[i]);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment