GridSearchCV vs RandomSearchCV and How it works? GridSearchCV vs RandomSearchCV

Can somebody explain in-detailed differences between GridSearchCV and RandomSearchCV?
And how the algorithms work under the hood?

As per my understanding from the documentation: 

RandomSearchCV

This uses a random set of hyperparameters. Useful when there are many hyperparameters, so the search space is large. It can be used if you have a prior belief on what the hyperparameters should be.

GridSearchCV

Creates a grid over the search space and evaluates the model for all of the possible hyperparameters in the space. Good in the sense that it is simple and exhaustive. On the minus side, it may be prohibitively expensive in computation time if the search space is large (e.g. very many hyper parameters).
Imagine the following scenario:

params = {
   epoch = [20, 30, 40, 50], #those numbers are only for example
   dense_layer_size = [20, 30], 
   second_danse_layer = [30, 40]    
}


In GridSearch you try all the combinations of your parameters, in this case: 

(4 * 2 * 2) = 16 #Total of parameters


In RandomSearch as in documentation: 


  Not all parameter values are tried out, but rather a fixed number of parameter settings is sampled from the specified distributions. The number of parameter settings that are tried is given by n_iter.


In this case, he select "n_iter" number of combinations and try then. Is good for optimizing less parameters, but, in cases when you don't have sure about multiples parameters, may let aside some combinations that would be better. 

Another good approach, is Using an genetic algorithm to optimize your network.

Genetic algorithm generate a few combinations of "individuals" (combination of parameters) and at each step, select the best individuals(called parents) and crossover then, generating more individuals with the characteristic from both parents. This way, in some case you can optimize your network and add random elements when you don't have sure about what parameter would be increase your result. 

If you want an easy to integrate genetic algorithm you can check this project.