private void generateTree(Node root) {
        while (itemsCount > 0) {
            int childCount = Math.abs(new Random().nextInt()) % 3;
            itemsCount--;
            switch (childCount) {
                case 0: {
                    root.right = null;
                    root.left = null;
                    break;
                }
                case 1: {
                    int leftOrRight = Math.abs(new Random().nextInt()) % 2;
                    if (leftOrRight == 0) {
                        root.left = new Node();
                        root.left.info = String.valueOf(getInfo());
                        generateTree(root.left);

                        root.right = null;
                    } else {
                        root.right = new Node();
                        root.right.info = String.valueOf(getInfo());
                        generateTree(root.right);

                        root.left = null;
                    }
                    break;
                }
                case 2: {
                    root.left = new Node();
                    root.left.info = String.valueOf(getInfo());
                    generateTree(root.left);

                    root.right = new Node();
                    root.right.info = String.valueOf(getInfo());
                    generateTree(root.right);

                    break;
                }
            }
        }
    }