Currently it's random, which is crap. Although items are scaled by character level when decrypted this is only up to level 20 and will stop being the case with the new hotfix. Personally I think engram quality should be by enemy level with a small degree of randomness within a certain band.
Careful, requiring it to be based
On enemy level will likely result in little to no drops.
Imagine doing patrol as a high level. You would have 0% chance of getting a drop. It needs to stay random; Cryptarch changes will improve the loot situation.