Legendary engrams specifically say that legendary items are random class, while blue items are not. Bungie apparently felt it was necessary to have 5 layers of RNG on both weapons (getting the engram, getting it to roll purple, getting the right slot, getting the right type of gun, and getting the right mods) and armor (getting the engram, getting it to roll purple, getting the right slot, getting the right class, and getting the right mods). I would argue that 3 is already pushing it and 5 is extremely excessive.