Randomize Order Of Numbers

Posted on 2011-03-16
Last Modified: 2012-05-11

I have a number string that i need to randomize every time.

"0123456789" i need it to randomize the order; ie, "0987234561"

can someone please help me with a solution in c#?

Question by:freezingHot
  • 2
LVL 53

Accepted Solution

Dhaest earned 500 total points
ID: 35148009
C# Randomize Chars in String

Author Closing Comment

ID: 35148028
short and sweet... thanks for the quick response.
LVL 14

Expert Comment

ID: 35148103
Will it always be numbers 0-9?

Is there a reason you want to use that string?

I would think using a random number 0-9 would suffice, and you could use a while (NumberSting < LenthWanted) and append random numbers to the string.

Author Comment

ID: 35148286
yes, i need to randomize the order of the numbers 0-9 each time a form is presented.

the linq solution above is quick and easy.... thanks.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to use xmlReader and idatareader  ? 4 55
IO.FileSystemWatcher dies when used in Powershell 1 44
Different Delete Messages 7 37
Error on Add method 1 37
Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now