Best shuffle: Difference between revisions

Content added Content deleted
(Removed division by zero bug from first D version)
(Cleaned D version)
Line 311: Line 311:
// txt and result must have the same length
// txt and result must have the same length
// allocate only when necessary
// allocate only when necessary
if (result.length != len) {
if (result.length != len)
debug { /* optional log of the heap allocation */ }
result.length = len;
result.length = len;
}


// how many of each character?
// how many of each character?