private boolean fillShipByRandom(Random random, int length)
    {
        int tryCount = 0;
        while (tryCount < SHIP_PLACEMENT_MAX_TRYS)
        {
        	tryCount++;
        	
        	// Choose random position
            int x1= Math.abs(random.nextInt()) % (SIZE);
            int y1= Math.abs(random.nextInt()) % (SIZE);
            
            // Choose random direction
            int x2= Math.abs(random.nextInt()) % (2) - 1;
            int y2= Math.abs(random.nextInt()) % (2) - 1;
            
            if(canPlaceShipHere(x1, y1, x1+x2*length, y1+y2*length)
                && (y2==0||x2==0)&&!((x2==0) && (y2==0))
                && isValidCoord(x1+x2*length, y1+y2*length))
            {
                for (int l = 0; l < length; l++)
                {
                    fField[x1 + x2*l][y1+y2*l] = VALUE_SHIP;
                }
                return true;
            }
        }
        
        return false;
    }