An algorithm is presented to relabel automatically the nodes of an arbitrary finite-element mesh. The purpose of such relabeling is to reduce the bandwidth of the master stiffness matrix produced by the finite-element method. The algorithm uses a random process for the relabeling. Computing time is reduced substantially, compared to systematic methods.