File: example_dist_rand.f90

package info (click to toggle)
fortran-stdlib 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,008 kB
  • sloc: f90: 24,178; ansic: 1,244; cpp: 623; python: 119; makefile: 13
file content (17 lines) | stat: -rw-r--r-- 616 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
program example_dist_rand
  use stdlib_kinds, only: int8, int16, int32, int64
  use stdlib_random, only: dist_rand, random_seed
  implicit none
  integer :: put, get

  put = 135792468
  call random_seed(put, get)     ! set and get current value of seed
  print *, dist_rand(1_int8)     ! random integer in [-2^7, 2^7 - 1]
! -90
  print *, dist_rand(1_int16)    ! random integer in [-2^15, 2^15 - 1]
! -32725
  print *, dist_rand(1_int32)    ! random integer in [-2^31, 2^31 - 1]
! -1601563881
  print *, dist_rand(1_int64)    ! random integer in [-2^63, 2^63 - 1]
! 180977695517992208
end program example_dist_rand