If you're running these in a locomotive, you need more than a diode and a resistor, you MUST have a filter capacitor to make smoothed DC. The flashing LED has a tiny logic circuit that actually does the flashing, if it is running on half-wave DC from a diode, or even full-wave DC from a bridge rectifier, the flash circuit won't work.
They don't need regulated DC, but they do need filtered DC.
Note that regular LED's run fine with a diode and a resistor off AC power.