System.Random.NextBytes C# (CSharp) Méthode

NextBytes() public méthode

public NextBytes ( byte buffer ) : void
buffer byte
Résultat void
      public virtual void NextBytes(byte [] buffer){
        if (buffer==null) throw new ArgumentNullException("buffer");
        for (int i=0; i<buffer.Length; i++) {
          buffer[i]=(byte)(InternalSample()%(Byte.MaxValue+1)); 
        }
      }
    }

Usage Example

Exemple #1
0
    public static short RandomShort()
    {
        byte[] randomBytes = new byte[2];
        _random.NextBytes(randomBytes);

        return((short)(randomBytes[0] + (randomBytes[1] << 8)));
    }
All Usage Examples Of System.Random::NextBytes