I want to make code that simple: take word on English and make random array with all character of the word. for intense, the word:"qweasdzxc" should represent like that: "adwseqzcx" (random) . so the code is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace randomLoop
{
class Program
{
static void Main(string[] args)
{
string s = "qweasdzxc";
string[] q = newArray(s);
for (int i = 1; i < s.Length - 1; i++)
{
Console.Write(q[i]);
}
}
public static char[] getArrayofstring(string s)
{
char[] c = s.ToCharArray();
return c;
}
public static Random rnd = new Random();
public static string[] charAndNumber(char c, int lengthOftheWord)//0-char 1-integer
{
string[] array = new string[2];
array[0] = c.ToString();
array[1] = (rnd.Next(lengthOftheWord)).ToString();
return array;
}
public static string[] newArray(string s)
{
string[] c = new string[s.Length];
int j = 1;
string[] q = charAndNumber(s[j], s.Length - 1);
for (int i = 1; i < c.Length - 1; i++)
{
c[i] = "";
}
int e = 1;
while (e.ToString() != q[1])
{
c[e] = q[0];
j++;//for the character s[j] see up
e++;//for the loop
}
return c;
}
}
}