It's based on your Agriculture skill and the plant. The [QUANTITY] for broad beans is set to 5 in the files, which I think is the maximum yield of pods per plant. But low Agriculture skill can cause you to lose some of the crop when you thresh. I suspect that your threshing tool affects yield as well. It's a random roll every time you thresh. You'll see this also with peas, but the maximum yield of peas is lower, so the variance is smaller.