I have made a small application from a book about F#, but when I call the rand.NextDouble() method it throws a BadImageFormatException, which at first glance looks like it's something to do with images so I have NO idea what I'm supposed to do here.
I know it's the nextdouble method that's the problem through trying with a seperate let
let create_field num_asteroids =
let lerp (x: float<'u>) (y:float<'u>) (a:float) =
x*a+y*(1.0-a)
let rand = Random()
[for i =1 to num_asteroids do
let m =
(lerp earth_mass moon_mass (rand.NextDouble()))*
1.0e-4
let x = lerp 0.0<m> field_size (rand.NextDouble())
let y = lerp 0.0<m> field_size (rand.NextDouble())
let vx = max_velocity*(rand.NextDouble()*2.0-1.0)*0.1
let vy = max_velocity*(rand.NextDouble()*2.0-1.0)*0.1
yield
{
Position = { X = x; Y = y }
Velocity = { X = vx; Y = vy }
Mass = m
Name = "a"
}
]
This is the errorcode:
System.BadImageFormatException was unhandled Message: An unhandled exception of type 'System.BadImageFormatException' occurred in Asteroid_Field_1.exe Additional information: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
MSDN tells me it might have something to with a DLL file not being loaded in the correct format, but I don't even know where to start.
this is the full code
Aucun commentaire:
Enregistrer un commentaire