Library/ManagedCuda/CudaRand/CudaRandDevice.cs
/// <summary>
/// Get scramble constants that can be used for quasirandom number generation.
/// <para/>
/// The array contains constants for many dimensions. Each dimension
/// has a single uint constant. 
/// </summary>
/// <returns></returns>
Get scramble constants that can be used for quasirandom number generation.

The array contains constants for many dimensions. Each dimension
has a single uint constant.
Get scramble constants that can be used for quasirandom number generation . The array contains constants for many dimensions . Each dimension has a single uint constant .
public static uint[] GetScrambleConstants32()
		{
			IntPtr ptr;
			CurandStatus status = CudaRandNativeMethods.curandGetScrambleConstants32(out ptr);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "curandGetScrambleConstants32", status));
			if (status != CurandStatus.Success) throw new CudaRandException(status);
			int[] consts_int = new int[MaxDimensions];
			uint[] consts_uint = new uint[MaxDimensions];
			Marshal.Copy(ptr, consts_int, 0, MaxDimensions);
			GCHandle handle = GCHandle.Alloc(consts_uint, GCHandleType.Pinned);
			Marshal.Copy(consts_int, 0, handle.AddrOfPinnedObject(), MaxDimensions);
			handle.Free();
			return consts_uint;
		}
public static uint [ ] GetScrambleConstants32 ( ) { IntPtr ptr ; CurandStatus status = CudaRandNativeMethods . curandGetScrambleConstants32 ( out ptr ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , status ) ) ; if ( status != CurandStatus . Success ) throw new CudaRandException ( status ) ; int [ ] consts_int = new int [ MaxDimensions ] ; uint [ ] consts_uint = new uint [ MaxDimensions ] ; Marshal . Copy ( ptr , consts_int , 0 , MaxDimensions ) ; GCHandle handle = GCHandle . Alloc ( consts_uint , GCHandleType . Pinned ) ; Marshal . Copy ( consts_int , 0 , handle . AddrOfPinnedObject ( ) , MaxDimensions ) ; handle . Free ( ) ; return consts_uint ; }
Get scramble constants that can be used for quasirandom number generation.
Get scramble constants that can be used for quasirandom number generation .
//Marshall.Copy cannot directly copy to an uint[] array. //So first copy to int[] and then to uint[]...  //Copy unmanaged array (ptr) to managed array of int[]: //Pin uint[] array to get IntPtr and copy data again.
None