megaNaj
BAN USER
Comments (2)
Reputation -15
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
-3
of 3 vote
here is a c# code that works......
public static string getTriple(string word)
{
string s = "";
Random rand = new Random();
int Sindex = rand.Next(word.Length);
s = word[Sindex].ToString();
while (s.Length != 3)
{
int index = randomize(word);
if (index > Sindex)
{
string a = word[index].ToString();
s = s + "" + a;
}
}
return s;
}
public static int randomize(string word)
{
Random rand = new Random();
int index = rand.Next(word.Length);
return index;
}
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
- megaNaj January 27, 2016