ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Reverse a string and randomly change the position of character of a string using C# and VB.Net<p>Hi <a class="username" rel="mvadukul">mvadukul</a>,</p> <p>Refer the below code.</p> <p><span style="text-decoration: underline;">C#</span></p> <pre class="brush: csharp">int[] array = new int[] { 123456, 654321, 321456, 456321, 213456, 214356 }; // Get array count. int count = array.Length; // Get reverse array. int[] arrayReverse = array.Reverse().ToArray(); // Get random no. var random = new Random(); int randomNumber = array[random.Next(array.Length)];</pre> <p><span style="text-decoration: underline;">VB.Net</span></p> <pre class="brush: vb">Dim array As Integer() = New Integer() {123456, 654321, 321456, 456321, 213456, 214356} &#39; Get array count. Dim count As Integer = array.Length &#39; Get reverse array. Dim arrayReverse As Integer() = array.Reverse().ToArray() &#39; Get random no. Dim random = New Random() Dim randomNumber As Integer = array(random.[Next](array.Length))</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/805426/Reverse-a-string-and-randomly-change-the-position-of-character-of-a-string-using-C-and-VBNet/https://www.aspforums.net:443/Threads/805426/Reverse-a-string-and-randomly-change-the-position-of-character-of-a-string-using-C-and-VBNet/Fri, 03 Mar 2017 02:57:48 GMTReverse a string and randomly change the position of character of a string using C# and VB.Net<p>Hi</p> <p>&nbsp;</p> <p>I need in String random and reverse&nbsp;</p> <p>&nbsp;</p> <p>For example random</p> <p>A,B,C,D,E</p> <p>IT WILL COUNT ALL 5 STRING BUT RANDOM LIKE B,E,C,A,D</p>https://www.aspforums.net:443/Threads/805426/Reverse-a-string-and-randomly-change-the-position-of-character-of-a-string-using-C-and-VBNet/https://www.aspforums.net:443/Threads/805426/Reverse-a-string-and-randomly-change-the-position-of-character-of-a-string-using-C-and-VBNet/Fri, 03 Mar 2017 05:05:07 GMTReverse a string and randomly change the position of character of a string using C# and VB.Net<p>Hi <a class="username" rel="mvadukul">mvadukul</a>,</p> <p>Refer the below code.</p> <p><span style="text-decoration: underline;">C#</span></p> <pre class="brush: csharp">string testString = &#34;A,B,C,D,E&#34;; // Get reverse string. char[] charArray = testString.ToCharArray(); Array.Reverse(charArray); string reverse = new string(charArray); // Get random string. Random random = new Random(); char[] randomArray = testString.Replace(&#34;,&#34;, &#34;&#34;).ToCharArray().OrderBy(x =&gt; random.Next()).ToArray(); string finalString = string.Join(&#34;,&#34;, randomArray);</pre> <p><span style="text-decoration: underline;">VB.Net</span></p> <pre class="brush: vb">Dim testString As String = &#34;A,B,C,D,E&#34; &#39; Get reverse string. Dim charArray As Char() = testString.ToCharArray() Array.Reverse(charArray) Dim reverse As New String(charArray) &#39; Get random string. Dim random As New Random() Dim randomArray As Char() = testString.Replace(&#34;,&#34;, &#34;&#34;).ToCharArray().OrderBy(Function(x) random.[Next]()).ToArray() Dim finalString As String = String.Join(&#34;,&#34;, randomArray)</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/805426/Reverse-a-string-and-randomly-change-the-position-of-character-of-a-string-using-C-and-VBNet/https://www.aspforums.net:443/Threads/805426/Reverse-a-string-and-randomly-change-the-position-of-character-of-a-string-using-C-and-VBNet/Fri, 03 Mar 2017 07:12:43 GMT