Hey guys, Im trying to use the library in GNU in VB2008 to generate random number with uniform distribution (actually will also use it for other distributions)...I already added dll under bin file and try to run the following code, but just cant make it work: Public Class Form1 Declare Function gsl_rng_uniform Lib "C:\vb\uniform\uniform\bin\Debug\libgsl.dll" (ByVal x As Double, ByVal y As Double) As Double Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim rr As Double rr = gsl_rng_uniform(1.0, 10.0) End Sub End Class It could be built with no problem and when I tried to run it, the following mistake poped out pointing to the "rr = gsl_rng_uniform(1.0, 10.0)": Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Anybody here knows what cause this problem? Or anybody here knows how to generate random variables with normal/uniform/exponetial/... distributions? ( i mean use some library, not by coding from the very beginning...) I appreciate ur time reading it and help.