Where Do The ICAO Numbers Assigned To Individual Flights Come From

The topic pretty much says it all. A Google search yields unsatisfactory results.

if you mean ‘flight designation’ or ‘callsign’, it comes from ICAO’s Annex 2 Rules of the Air, Flight Plan, and for the airlines has a close relation to their scheduled, mostly IATA, flight numbers.For general aviation is usually the ‘tail number’ or ‘aircraft registration’.
as an example KL427 iata schedule flight number, corresponds to KLM427 icao ifr flight plan callsign./ flight number.

see also https://ops.group/blog/wp-content/uploads/2017/03/ICAO-Doc4444-Pans-Atm-16thEdition-2016-OPSGROUP.pdf

Thanks to all.

I got it in my head that the number was generated for each flight which seemed to me at the time to be a rather difficult thing to do.

Now I get it.