Azienda coinvolta
How to randomly select a number with equal probability from an array with unknown size?
Anonimo
Keep a variable as the return result and current size of the array. Update the result with probability size-1/size, when getting new number.
Non lasciarti sfuggire opportunità e informazioni privilegiate seguendo le aziende dove vorresti lavorare.
Ricevi suggerimenti e aggiornamenti personalizzati avviando le tue ricerche.