The concept of "generator" is extremely versatile. In different fields of science and technology, different meanings are put into it. Therefore, we can talk about what generators are only in the context of a certain subject area.
In a broad sense, generators are understood as any mechanical, electrical and electronic devices, machines and devices that produce any products (substances or energy) with specified characteristics. In various fields of science, as well as technical and industrial fields, there are well-established concepts of the term "generator".
In the chemical, as well as some other areas of the industry, devices that produce gases are often used. For example, a hydrogen generator or an acetylene generator. Machines that convert substances into certain states of aggregation are also often called generators. For example, a steam generator or an ice maker.
In theoretical physics, there are concepts about abstract devices with ideal properties, called sources or generators. For example, this is a direct current generator (the current generated by it does not depend on the load resistance), a voltage generator (EMF), an alternating current generator with a given amplitude and frequency.
In the power industry, generators are called real machines and units that produce electrical energy. These include both alternating current generators (from bicycle or automobile to steam-gas or hydro-turbine generators at power plants) and direct current (galvanic cells, Faraday disk, magnetohydrodynamic generators) current.
In electronics, signal generators are mainly used. They are necessary to obtain currents of various characteristics (amplitude, frequency, phase) and electrical forms in the circuits of the equipment. There are many typical schemes of various generators (single and multivibrators, sinusoidal oscillators, blocking generators, etc.).
In programming, a generator is understood as a program or a part of it (a class with a set of methods, a procedure, a function) that creates data sets with the desired characteristics. For example, a pseudo-random number generator or a documentation generator program (such as Doxygen).