diff --git a/cv6/a_station.c b/cv6/a_station.c index 494eb1e..9aa8696 100644 --- a/cv6/a_station.c +++ b/cv6/a_station.c @@ -27,12 +27,11 @@ void destroy_station(struct station* station){ int select_track(struct station* station, const char* target){ unsigned int hash = 0; for(int i = 0; target[i] != '\0'; i++){ + //i used "lose lose" function, because it's simple and clear hash += target[i]; - //hash = target[i] + (hash << 6) + (hash << 16) - hash; } - //if(hash < 0 || hash > station->track_count){ - hash = hash % station->track_count; - //} + //change hash, so that it will be between 0 and station->track_count + hash = hash % station->track_count; return hash; }