Storyline missions generate as 1 storyline mission per every 16 missions of the same level done for the same faction, and assign to the nearest storyline agent of that faction (so it could be a security mission even if you ran 16 distribution missions, or vice versa).
Storyline missions are not the only option for repairing faction standings, and in some cases are a bad choice depending on your other standings, as all storyline missions have derived faction standing impacts based on the relationship between the mission faction and the other factions.
Resources for researching your specific best option, based on your play style and current/target faction standings, include:
@DeMichael_Crimson’s FACTION STANDING REPAIR PLAN aka ‘The Plan’
@Archer_en_Tilavine’s Extension to the Faction Standings Repair and Improvement Plan