subroutine nbi_random_init(nseed,ioffset,incpu)

  use nbi_random
  implicit none

  !
  !  init nbi random numbers
  !  use charles karney's f90 rng interface
  !     (see nbi_random module)
  !

  integer, intent(in) :: nseed      ! integer to init rng seed
  integer, intent(in) :: ioffset    ! offset beyond which to advance seed
  integer, intent(in) :: incpu      ! (eventually) no. of cpus / parallel
                                    ! random number streams.

  !  (parallel random number streams not yet used as nubeam has not been
  !  parallelized)

  call rng_set_seed(rng_seed,nseed)
  call rng_step_seed(rng_seed,ioffset+incpu)

  call rng_init(rng_seed,rng_curstate)

  call rng_number(rng_curstate,nbi_srng)
  nbi_srng_ptr = 1

  call rng_gauss(rng_curstate,nbi_sgauss)
  nbi_sgauss_ptr = 1

end subroutine nbi_random_init
