Fixed by rewriting standard_write function to be iterative instead of recursive. Previously ruby was running out of stack space in many cases where the parameter was 50000W. Also added in this pull request is a very minor performance enhancement in select_random (called by standard_write) where if only 1 item is present, it picks the 1 item instead of generating a random number from 0 to 0.
Fixed by rewriting standard_write function to be iterative instead of recursive. Previously ruby was running out of stack space in many cases where the parameter was 50000W. Also added in this pull request is a very minor performance enhancement in select_random (called by standard_write) where if only 1 item is present, it picks the 1 item instead of generating a random number from 0 to 0.