EEPROMs work by storing charge in floating-gate transistors. Think of these transistors like tiny capacitors that leak extremely slowly (typically with retention lifetimes of 10+ years), except with the added provision that you can tell whether it's charged or uncharged. Programming one simply involves feeding it a power source and pulling the gate to high or low voltage for a short time. The internal mechanism is called tunnel injection. If you leave the gate "floating" (i.e. neither connected to ground or positive voltage) after disconnecting the power, it remains at the stored value.
Clearing the data on an EEPROM should simply involve setting it all to uncharged. However, tiny ferrous impurities in the die and connectors may have sufficient magnetic susceptibility to remain partially magnetised by the tiny electric field produced by the held charge. By analysing this magnetisation, it may be possible to deduce latent data. As such, writing random data may provide sufficiently overbearing charges to prevent analysis. However, a better option would be to set all cells to 1, then 0, then random. This is because there may be cases where tiny magnetisation deltas are useful to an attacker, which are guaranteed to be destroyed when all cells are charged then discharged.
Flash memory is a different story, and actually uses two different technologies. NAND flash is common, as is NOR. Both types only allow writes in blocks (or "pages"), though typically NAND blocks are much larger than NOR blocks (which are usually a byte).
NAND flash is very similar to EEPROMs in terms of construction, in that they use floating-gate transistors. However, the transistors are arranged in a series chain. This construction means that two options can be performed: setting a single bit to 1, or setting all bits in the cell to 0. NOR flash works in a similar way, but performs hot-electron injection through a charge pump instead. The most important distinction here is that NOR flash requires the charge pump to produce a very high instantaneous voltage, whereas NAND performs writes at a much lower internal voltage.
As such, NAND technology is less likely to promote detectable magnetisation of ferrous impurities than NOR, but holds about equal risk to EEPROM. I would still recommend the 1, 0, random triple-pass for high security, but a single random pass should be more then enough for anyone not worried about attackers that have access to electrostatic force microscopy equipment.
You should also keep in mind that these attacks are very much theoretical, and I don't believe anyone has ever managed to recover fully erased data from an EEPROM.