By using nanoscale energy-transfer dynamics and density matrix formalism, we demonstrate theoretically and numerically that chaotic oscillation and random-number generation occur in a nanoscale system. The physical system consists of a pair of quantum dots (QDs), with one QD smaller than the other, between which energy transfers via optical near-field interactions. When the system is pumped by continuous-wave radiation and incorporates a timing delay between two energy transfers within the system, it emits optical pulses. We refer to such QD pairs as nano-optical pulsers (NOPs). Irradiating an NOP with external periodic optical pulses causes the oscillating frequency of the NOP to synchronize with the external stimulus. We find that chaotic oscillation occurs in the NOP population when they are connected by an external time delay. Moreover, by evaluating the time-domain signals by statistical-test suites, we confirm that the signals are sufficiently random to qualify the system as a random-number generator (RNG). This study reveals that even relatively simple nanodevices that interact locally with each other through optical energy transfer at scales far below the wavelength of irradiating light can exhibit complex oscillatory dynamics. These findings are significant for applications such as ultrasmall RNGs.