The Ibrox club, relaunched in the Irn-Bru Third Division this season, were paired with First Division Bairns at the Hampden draw on Thursday afternoon.
Holders Kilmarnock begin the defence of their trophy with a home game against Second Division Stenhousemuir.
There are some tricky away ties for other Clydesdale Bank Premier League clubs.
Hibernian are at Queen of the South, Aberdeen travel to Morton and Inverness face Arbroath at Gayfield while SPL new boys Dundee will get a trip to Hampden to meet Queen's Park.
The ties will take place on Tuesday August 28 or Wednesday August 29.
St Mirren v Ayr United
Queen's Park v Dundee
Livingston v Dumbarton
Arbroath v Inverness
Ross County v Raith Rovers
Morton v Aberdeen
Kilmarnock v Stenhousemuir
Queen of the South v Hibernian
Dunfermline v Montrose
Rangers v Falkirk
Hamilton v Partick Thistle
Celtic, Dundee United, Motherwell, St Johnstone and Hearts all receive byes after qualifying for Europe last season.