Microsoft.Protocols.TestSuites.BranchCache.TestUtility.GenerateRandomArray C# (CSharp) Method

GenerateRandomArray() public static method

public static GenerateRandomArray ( int length ) : byte[]
length int
return byte[]
        public static byte[] GenerateRandomArray(int length)
        {
            Random random = new Random();
            byte[] data = new byte[length];
            random.NextBytes(data);
            return data;
        }

Usage Example

        public Content_Information_Data_Structure_V2 CreateContentInformationV2()
        {
            var contentInformation = new Content_Information_Data_Structure_V2
            {
                bMajorVersion          = 2,
                bMinorVersion          = 0,
                ullIndexOfFirstSegment = 0,
                ullLengthOfRange       = DefaultBlockSize,
                dwOffsetInFirstSegment = 0,
                ullStartInContent      = 0,
                dwHashAlgo             = dwHashAlgoV2_Values.TRUNCATED_SHA512,
                chunks = new ChunkDescription[]
                {
                    new ChunkDescription
                    {
                        dwChunkDataLength = DefaultBlockSize,
                        chunkData         = new SegmentDescriptionV2[]
                        {
                            new SegmentDescriptionV2
                            {
                                cbSegment         = DefaultBlockSize,
                                SegmentHashOfData = TestUtility.GenerateRandomArray(32),
                                SegmentSecret     = TestUtility.GenerateRandomArray(32)
                            }
                        }
                    }
                }
            };

            return(contentInformation);
        }
All Usage Examples Of Microsoft.Protocols.TestSuites.BranchCache.TestUtility::GenerateRandomArray