[UP]


Manual Reference Pages  - generate_uuid (3)

NAME

generate_uuid(3f) - [M_uuid] generate a UUID (Universally Unique IDentifier) string per RFC 4122 (LICENSE:CUSTOM OPEN)

CONTENTS

Synopsis
Description
Authors
Options
Example

SYNOPSIS

function generate_uuid(version) result(uuid)

    integer, intent(in), optional :: version
    character(len=36) :: uuid

DESCRIPTION

A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems. When generated according to standard methods UUIDs are for practical purposes unique. generate_uuid(3f) converts the UUID to a standard string format per RFC 4122.

AUTHORS

based on previous work from Alberto Garcia & Jon Wakelin, 2003-2004. RNG routines from Scott Ladd <scott.ladd@coyotegulch.com>, and the libFoX library( Toby White <tow@uszla.me.uk>, Gen-Tao Chiang <gtc25@cam.ac.uk>, Andrew Walker <a.walker@ucl.ac.uk>).

OPTIONS

version
  Indicates which standard method as described in RFC 4122 is used to generate the string. Versions 0,1, and 4 are supported.
0. Nil UUID (ie. ’00000000-0000-0000-0000-000000000000’)
1. time-based UUID
2. Not implemented
3. Not implemented
4. pseudo-RNG(Random Number Generator) based
5. Not implemented

EXAMPLE

Sample usage:

   program demo_generate_uuid
   use M_uuid, only : generate_uuid
   implicit none
   character(len=36) :: uuid
      !
      uuid=generate_uuid(1)  ! version 1 (time-based UUID)
      write(*,’(a36)’)uuid
      !
      uuid=generate_uuid(4)  ! version 4 (pseudo-RNG-based), default
      !
      ! RFC 4122 defines a Uniform Resource Name (URN) namespace for UUIDs.
      write(*,’("urn:uuid:",a36)’)uuid
      !
      ! a good scratch file name
      open(file=’/tmp/scratch_’//uuid,unit=10)
      !
   end program demo_generate_uuid

Typical output:

    e769adf4-4af7-11e8-7421-3c9dfbfe9aab
    urn:uuid:5b0946b8-0eb4-4966-619d-047b7f7e2056


generate_uuid (3) March 11, 2021
Generated by manServer 1.08 from ab9ebce1-d171-493b-a559-216e2dc8db35 using man macros.