public string buildQuestionToFirstLevel() { Random rnd = new Random(); //For mixing the choices between with skills and without. int chooseWithSkills = rnd.Next(100) % 10; if (chooseWithSkills < 4) { string skillParameter = ""; if ((skillParameter = getSkill("song")) != null) { this.songForQuiestion = db.GetSongByID(skillParameter); } else if (((skillParameter = getSkill("artist")) != null) && (songForQuiestion == null)) { this.songForQuiestion = db.GetRandomSongByArtistID(skillParameter); } else if (((skillParameter = getSkill("year")) != null) && (songForQuiestion == null)) { this.songForQuiestion = db.GetRandomSongByYear(skillParameter, false); } //If there is no skill - choose question by other random parameter } if (this.songForQuiestion == null) { do { int chooseQuestionMethod = rnd.Next(1, 4); // creates a number between 1 and 3 switch (chooseQuestionMethod) { case 1: this.songForQuiestion = this.db.GetSongOfArtistByPopularity(0.8, 1); break; case 2: this.songForQuiestion = this.db.GetRandomTopSongSkillsSong(); break; case 3: this.songForQuiestion = this.db.GetRandomTopYearSkillsSong(); break; } } while (this.songForQuiestion == null); } this.Question = this.Question.Replace("<artist_name>", this.songForQuiestion.Artist_name); this.Question = this.Question.Replace("<year>", this.songForQuiestion.Year.ToString()); return(this.Question); }