make limitation for random class in c# -


Do I want to create random ranges to generate random variables from 2 categories without replacing C # in the random class? Example: exponents [i] = random Next (0, 25); Ypoints [i] = Random Next (0, 12);

Where there are 25 to 12 image dimensions, I want all the pixels in this picture, but random? Any suggestions if I use this code then I did not find some pixels and repeated a few pixels.

update Not required [1]

Update Generalized General Extensions in Extensions Method Generalized

  Public Fixed IEnumerable & lt; T & gt; Simple Shuffle & lt; T & gt; (This IEnumerable & lt; T & gt; Sequence) {var rand = new Random (); Return sequence Selection (i = & gt; new {i, k = rand.Next ()}). OrderBe (P = & gt; PK) Selection (P = & gt; Pi); }   

However, in addition to downwitting (shouting? Sorry :)) answering the anx I thought it would be good to show how my code looks:

 using the  system; Using System.Linq; Using System.Collections.Generic; Namespace Ns {Static class program {public static IEnumerable & lt; T & gt; Simple Shuffle & lt; T & gt; (This IEnumerable & lt; T & gt; Sequence) {var rand = new Random (); Return order Selection (i = & gt; new {i, k = rand.Next ()}). Order B (P => PK). Selection (P = & gt; Pi); } Public static zero main (string [] args) {var pots = N to X-ray range. Choose the enumerable range (0, 24) from the range (0, 24) y. New {x, y}; Förch (PT SimplesPhil ()) console in PR. Weedline ("{0}, {1}", PTX, PTI); }}}   

I have completely fixed a problem that does not require a hash in the manner of generating a good hash unless that:

  • a The source (logical) is duplicate (logical)
  • b and we need to order the same sort of them
  • c and we want to repeat the same 'random' sort order (desirtaneous hashing) each time

    A and B are false in this case and C There was also a problem (depending on the requirement of OP), so now, without any string attached, no worries about performance (even irrational concerns may occur),

    [1] By coincidence, this makes the whole thing more flexible because I no longer have to convey the quote byte []; Now you want to shuffle any structure.

Comments