mirror of
https://github.com/tu-darmstadt-informatik/AuD18.git
synced 2025-12-13 01:45:49 +00:00
Add funfact
This commit is contained in:
parent
b342b08533
commit
d7d5e7f92c
@ -377,6 +377,9 @@ public class HashTable {
|
||||
// Convert sum back to string to cut off excess leading digits, then take mod capacity
|
||||
String res = Integer.toString(sum);
|
||||
return Integer.parseInt(res.substring(res.length() - addrLength, res.length())) % this.capacity;
|
||||
|
||||
// Just for fun, here's a ruby one-liner that does the exact same thing in about 2/3 of a tweet
|
||||
// value.chars[0..4].map(&:ord).join.reverse.chars.each_slice(a=Math.log10(c=capacity).ceil).map.with_index{|e,i|e=e.join.ljust(a,"0");i%2==0? e.to_i: e.reverse.to_i}.sum%10**a%c
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user