Fixes random generation; closes #1