
  sys seed=0x12345678

  '-----------------------
  Function Rnd() as Single
  '=======================
  '
  Static As Single f, d=1/0x7fffffff
  mov eax,seed
  rol eax,7
  imul eax,eax,13
  mov seed,eax
  push eax
  fild dWord [esp]
  add esp,4
  fmul dWord d
  fstp dWord f
  Function=f
  End Function

  '---------------------
  Function Rndi() as sys
  '=====================
  '
  mov eax,seed
  xor eax,0x35353535
  imul eax,eax
  ror eax,17
  imul eax,seed
  ror eax,7
  mov seed,eax
  return eax
  End Function



  'Double multidimensional Hypoteneuse

  '------------------------------------
  Function Hypotnd(sys n,...) as double
  '====================================
  sys p=@n+sizeof sys
  double d at p
  double a
  sys i
  for i=1 to n
    a+=d*d
    p+=sizeof double
  next
  return sqr(a)
  end function


  '------------------------------------------------
  Function InRange(double lower,value,upper) as sys
  '================================================

  if value<lower then exit function
  if value>=upper then exit function
  return -1
  end function


  '-------------------------------------------------
  Function Limit(double lower,value,upper) as double
  '=================================================
  if value<lower then return lower
  if value>upper then return upper
  return value
  end function




