random method improved