The method takes 1 array and using random to shuffle the array the value of rndm1-4 didn't change. and after the loop, it acts normal. I think the problem is in the while loop. public static string[] Shuffle(string[] array) {     string str1, str2, str3, str4;     Random rnd1 = new Random();     Random rnd2 = new Random();     Random rnd3 = new Random();     Random rnd4 = new Random();     int rndm1 = rnd1.Next(3);     int rndm2 = rnd2.Next(3);     int rndm3 = rnd3.Next(3);     int rndm4 = rnd4.Next(3);          while ((rndm1 != rndm2) &amp;&amp; (rndm1 != rndm3) &amp;&amp; (rndm1 != rndm4)          &amp;&amp; (rndm2 != rndm3) &amp;&amp; (rndm2 != rndm4) &amp;&amp; (rndm3 != rndm4))     {         rndm1 = rnd1.Next(3);         rndm2 = rnd2.Next(3);         rndm3 = rnd3.Next(3);         rndm4 = rnd4.Next(3);     }          str1 = array[0];     str2 = array[1];     str3 = array[2];     str4 = array[3];     array[rndm1] = str1;     array[rndm2] = str2;     array[rndm3] = str3;     array[rndm4] = str4;     return array; }
What is the best way to randomize an array of strings with .NET? My array contains about 500 strings and I'd like to create a new Array with the same strings but in a random order.  Please include a C# example in your answer.
What is aperture, and how does it affect my photographs? Is there a reason why we gain ghost reputation on the meta of an SE website? Is there any reason behind the ghost reputation we gain on the meta of a Stack Exchange site? This reputation doesn't add up to anything, but it still shows me I have gained some. Is this supposed to make any sense? Show that no application $f: \mathbb{R}^2 \rightarrow \mathbb{R}$, of $C^k$ class, $k \geq 1$ can be injective How can I proof this:     Show that no application $f: \mathbb{R}^2 \rightarrow \mathbb{R}$, of $C^k$ class, $k \geq 1$ can be injective, i.e., there are $A,B \in \mathbb{R}^2$ such that $A \neq B$ and $f(A) = f(B)$ (Hint: show that given $(a,b) \in \mathbb{R}^2$ in every open neighbourhood of $(a,b)$ there are points $(c,d),(c_1,d_1)$ where ${\partial}_1f(c,d) \neq 0$ or ${\partial}_1f(c_1,d_1) \neq 0$).   The problem is that I have no idea how to use the hint.  Thanks for all your comments. I have a range and need to sum it using SUM function but the result is N/A if there is any N/A value. How can I make the SUM function to treat the N/A value as 0 value?  Please help! How did they post process before Photoshop? Getting all files that have been modified on a specific date Is it possible to find all php files within a certain directory that have been modified on a certain date  I'm using   find /var/www/html/dir/ -mtime -28 | grep '\.php'    to get files modified within the last 28 days, but I only need files that have been modified on the following date: 2011-02-08 Deep confusion with conventions and signs in geometric optics This is an equation given in my book.     The question is why have they used a negative sign on the LHS?   Now, if you try to derive the mirror equation with simple geometry, you get  1/v +1/u =1/f . I got that equation without applying any signs there!  So what is the need to apply the signs ‘here'?   If i try to derive this equation ( the one in the photo ) i get the exact answer, but with the positive sign in the LHS. WHY we use the negative sign in the derivation, and then  again we use conventions while solving the questions? Do I need to enable the publishing features to change a Team Site's master page? When building a SharePoint 2010 site, we have a root Publishing site that has been branded up using a custom Master Page.  We'd now like to add some Team Sites below the publishing site, and have our branding and other look and feel changes applied there too, and for that we need to change the "System Master" setting of the Team Site.  The "Master page" options in the site settings are only available if I've enabled the Publishing features in the team site, but I'd rather not do this if I can avoid it.  Ideally, this should be enabled as soon as a new team site is created, without the site owner having to change the site settings. What formula should be used to determine "hot" questions? Right now  is fairly broken -- it's a simple descending sort by views. As Joel said , it is &quot;a self-fulfilling prophecy.&quot; But this is not intentional, it's only because we haven't had time to improve it yet! As I sit down to write a better algorithm, I thought you guys might have some insight into what would make a good formula to determine the &quot;hot&quot; questions -- over the last 24 hours, the last week, the last month, and all time. Here are the variables we have to work with:  Votes [aka Score] Views Answers Answer Votes [aka Score] Whether the question has an accepted answer or not Time question was originally asked Time of last activity on question Reputation of asker Reputation(s) of answerers  Joel cited the reddit formula as an example, but I think our site is a little different than just a basic link submission site. Plus, we have more variables and data to work with. I found a  describing a few formulas: Y Combinator Hacker News  (p - 1) / (t + 2)^1.5 p = votes (points) from users t = time since submission in hours  Reddit  t = (time of entry post) - (Dec 8, 2005) x = upvotes - downvotes y = {1 if x &gt; 0, 0 if x = 0, -1 if x &lt; 0) z = {1 if x &lt; 0, otherwise x} log(z) + (y * t)/45000  Thoughts? Ideas? I don't want to overthink this; I just want the &quot;hot&quot; questions to be relevant and useful to us. So the simpler the algorithm the better! Based on my analysis of the above and the comments so far, here's the second version of what I have implemented so far. This might suck. I don't know:  (log(Qviews)*4) + ((Qanswers * Qscore)/5) + sum(Ascores) -------------------------------------------------------- ((QageInHours+1) - ((QageInHours - Qupdated)/2)) ^ 1.5  Note that accepted answers weight not at all in hotness. This is intentional, as I feel accepted answers are a fine social contract, but not a good data point for question or answer quality. This algorithm will heavily favor questions with LOTS of answers, as the sum(Ascores) are now included -- one assumes if there are lots of answers, there will be a lot more voting on the answers, too. Update: Note that this formula is what is used on the  linked from the homepage of each site. It is not the formula used to determine the  list. See . Plot Option Precedence while combining Plots with Show[] I'm downloading Sentinel-2 tiles from  but they dont seem to be 100 % aligned. Right image is band 08 Sentinel-2 added to ArcGis Desktop (i have done nothing more than adding the 08.jp2 to the map), left esri basemap photo. The offset in Sentinel is about 35-40 meters. How do i correct them?    . Level-1C, Sentinel-2:   SOLUTION:  From HDunn's answer i did this:  Using a road vector layer i added five point pairs and calculated difference in x and y coordinates. The mean differences i used as xvalue and y value in Shift tool. Result: dpkg exit with error "cannot scan updates directory `/var/lib/dpkg/updates/': No such file or directory", how to fix it? Earlier, I had a problem with a package, and I (wrongly) ran this:  rm -r /var/lib/dpkg/*   See also .  Now when I try to upgrade, I get this:  E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it? masoud@masoud-PC:~$ sudo apt-get upgrade  E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?   and when I use: sudo dpkg --configure -a   I get this:  dpkg: error: cannot scan updates directory `/var/lib/dpkg/updates/': No such file or directory     and for sudo apt-get upgrade -f get:  Reading package lists... Done Building dependency tree        Reading state information... Done Correcting dependencies... failed. The following packages have unmet dependencies:  ia32-libs : Depends: ia32-libs-multiarch but it is not installable  wine1.4 : Depends: wine1.4-i386 (= 1.4.1-0ubuntu5) but it is not installable E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages. E: Unable to correct dependencies What are the origins of the word "nice"? No Dialect mapping for JDBC type: -9 with Hibernate 4 and SQL Server 2012 Multi-Question Questions: How Best to Handle Them? Sometimes I come across a question on SO that is actually a number of questions all in one. If these &quot;sub-questions&quot; are closely related, it's not a problem. But if they are only weakly related (or not at all) it gets ugly. I'm now (ironically or hypocritically) going to ask a few questions of my own for the community to respond to:  Do you consider a question made up of a number of weakly-related sub-questions &quot;inappropriate&quot;? Why or why not? How many is too many sub-questions? What do you think is the best way to deal with such questions?  As an example,  I had some discussion about with another user. I will add a more complete version of my response in an answer below, but in short I felt that this question should be closed and many of the questions asked separately. Negative pressure How is negative pressure created in a fluid system?Isn't it counter intuitive that we are reducing the pressure of a system containing no molecules(zero pressure) to a lower value? Fitting unbreakable large equation on one line in a twocolumn layout Terms for collections of animals As I watched the murder of crows sitting on the line above my house this evening, I got wondering where all of the collective nouns for animals (pod of whales, gaggle of geese, pride of lions) came from and why we need so many.    If sheep can be a flock, why can't whales, geese, lions, and crows? MWE:  \documentclass{article} \begin{document} $\wedge{\small\wedge}{\tiny\wedge}$ \end{document}   All the \wedges have the same size... What are the best strategies for assessing if a journal is a &quot;vanity&quot; or &quot;predatory&quot; journal that should be avoided (both for publishing in and reviewing for)? For example, how would one go about determining if a journal/publisher belongs on ?