Exemple #1
0
 public RandomGen(RandomByteDataProvider provider, int bufferSizeInBytes)
 {
     Contract.Requires(bufferSizeInBytes >= 8);
     Contract.Requires(bufferSizeInBytes % 4 == 0);
     Contract.Requires(provider != null);
     byte[] byteBuffer = new byte[bufferSizeInBytes];
     this.buffer = new int[bufferSizeInBytes / 4];
     this.provider = (int[] randomData) =>
         {
             provider(byteBuffer);
             Buffer.BlockCopy(byteBuffer, 0, buffer, 0, bufferSizeInBytes);
         };
 }
Exemple #2
0
 public RandomGen(RandomByteDataProvider provider, int bufferSizeInBytes)
 {
     Contract.Requires(bufferSizeInBytes >= 8);
     Contract.Requires(bufferSizeInBytes % 4 == 0);
     Contract.Requires(provider != null);
     byte[] byteBuffer = new byte[bufferSizeInBytes];
     this.buffer   = new int[bufferSizeInBytes / 4];
     this.provider = (int[] randomData) =>
     {
         provider(byteBuffer);
         Buffer.BlockCopy(byteBuffer, 0, buffer, 0, bufferSizeInBytes);
     };
 }
		public RandomGen(RandomByteDataProvider provider, int bufferSizeInBytes)
		{
			Contract.Requires(bufferSizeInBytes >= 8);
			Contract.Requires(bufferSizeInBytes % 4 == 0);
			Contract.Requires(provider != null);
			var byteBuffer = new byte[bufferSizeInBytes];
			Buffer = new int[bufferSizeInBytes / 4];
			_provider = randomIntData =>
				{
					provider(byteBuffer);
					System.Buffer.BlockCopy(byteBuffer, 0, randomIntData, 0, bufferSizeInBytes);
				};
		}