Random.NextBytes メソッド
アセンブリ: mscorlib (mscorlib.dll 内)



バイト配列の各要素は、0 以上 MaxValue 以下の乱数に設定されます。
ランダム パスワードの作成に適した、暗号として安全な乱数を生成するには、たとえば、RNGCryptoServiceProvider.GetBytes などのメソッドを使用します。

Dim rnd As New Random() Dim b(10) As Byte rnd.NextBytes(b) Console.WriteLine("The Random bytes are: ") Dim i As Integer For i = 0 To 9 Console.Write(i) Console.Write(":") Console.WriteLine(b(i)) Next i
Random rnd = new Random(); Byte[] b = new Byte[10]; rnd.NextBytes(b); Console.WriteLine("The Random bytes are: "); for (int i = 0; i < 10; i++) { Console.Write(i); Console.Write(":"); Console.WriteLine(b[i]); }
Random^ rnd = gcnew Random; array<unsigned char>^b = gcnew array<unsigned char>(10); rnd->NextBytes( b ); Console::WriteLine( "The Random bytes are: " ); for ( int i = 0; i < 10; i++ ) { Console::Write( i ); Console::Write( ":" ); Console::WriteLine( b[ i ] ); } } /* This code produces the following output. myQ is not synchronized. mySyncdQ is synchronized. */

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からRandom.NextBytes メソッドを検索する場合は、下記のリンクをクリックしてください。

- Random.NextBytes メソッドのページへのリンク