Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetNonZeroBytes() [2/2]

override void System.Security.Cryptography.RandomNumberGeneratorImplementation.GetNonZeroBytes ( Span< byte > data)
inlinevirtual

Reimplemented from System.Security.Cryptography.RandomNumberGenerator.

Definition at line 57 of file RandomNumberGeneratorImplementation.cs.

58 {
59 while (data.Length > 0)
60 {
61 GetBytes(data);
62 int num = data.Length;
63 for (int i = 0; i < data.Length; i++)
64 {
65 if (data[i] == 0)
66 {
67 num = i;
68 break;
69 }
70 }
71 for (int j = num + 1; j < data.Length; j++)
72 {
73 if (data[j] != 0)
74 {
75 data[num++] = data[j];
76 }
77 }
78 data = data.Slice(num);
79 }
80 }
Span< T > Slice(int start)
Definition Span.cs:271
int Length
Definition Span.cs:70

References System.Security.Cryptography.RandomNumberGeneratorImplementation.GetBytes(), System.Span< T >.Length, and System.Span< T >.Slice().