Javascript testing random-functions