In this paper, an approach to weighting features for classification based on the nearest-neighbour rules is proposed. The weights are adaptive in the sense that the weight values are different in various regions of the feature space. The values of the weights are found by performing a random search in the weight space. A correct classification rate is the criterion maximised during the search. Experimentally, we have shown that the proposed approach is useful for classification. The weight values obtained during the experiments show that the importance of features may be different in different regions of the feature space