>

User's Guide: Usage:Languages


C and FORTRAN Usage

SPRNG code is written in C. However, wrappers are provided for use by FORTRAN programmers too. In this section, we discuss some of the steps programmers in either of these languages need to take in order to use SPRNG.

C Usage

C users need to include the header file sprng.h.

Example

C++ Usage

C++ users can follow the instructions given for C users.

Serial Example
Parallel Example

FORTRAN Usage

FORTRAN users need to include the header file sprng_f.h. If FORTRAN users make SPRNG calls in several subroutines, then they will need to include this file at the beginning of each subroutine. FORTRAN users should also be aware that certain SPRNG functions return pointers. These can be handled by FORTRAN users as mentioned in the note on Stream ID's. FORTRAN users who are not familiar with preprocessing directives could also take a look at the note on this topic.

While SPRNG's FORTRAN documentation has been written keeping in mind FORTRAN 77 users, FORTRAN 90 users too can follow the same instructions, but replacing the FORTRAN 77 compiler with the FORTRAN 90 compiler.

Example


[Quick 
Start] [User's 
Guide] [Reference 
Manual] [Quick 
Reference]