Sampling-based algorithms are widely used in robotics because they are very useful in high dimensional spaces. However, the rate of success and quality of the solutions are determined by an adequate selection of their parameters such as the distance between states, the local planner, and the sampling method. For robots with large configuration spaces or dynamic restrictions selecting these parameters is a challenging task. This paper proposes a method for improving the results for a set of the most popular sampling-based algorithms, the Rapidly-exploring Random Trees (RRTs) by adjusting the sampling method. The idea is to replace the sampling function, traditionally a Uniform Probability Density Function (U-PDF) with a custom distribution (C-PDF) learned from previously successful queries of a similar task. With few samples, our method builds the custom distribution allowing a higher success rate and sparser trees in randomly new queries. We test our method in several common tasks of autonomous driving such as parking maneuvers or obstacle clearance and also in complex scenarios outperforming the base original and bias RRT. In addition, the proposed method requires a relative small set of examples, unlike current deep learning techniques that require a vast amount of examples.