The following demonstrates how to use Delphi language to download random data from SwiftRNG device when used with Windows. Before using the following examples, make sure your Delphi project is targeted for Windows 32 bit platform and the SwiftRNG device is plugged into one of USB ports available. A thread-safe and process-safe 32 bit SwiftRNG.dll is included in the software kit.

Note: The following method is deprecated. Please use an alternative method as described at this location.

A sample source code for retrieving an array of bytes from SwiftRNG device using 32 bit SwiftRNG.dll

//
//
// A sample Delphi program that demonstrates how to retrieve random bytes from
// SwiftRNG device using 32 bit SwiftRNG.dll.
// Author: Zac
//

program Project1;

{$APPTYPE CONSOLE}
{$R *.res}

uses
  System.SysUtils;

const
  randomNumberCount = 50; // How many random bytes to retrieve

type
  RandomBuffer = array [0 .. (randomNumberCount - 1)] of byte;
  xbuffer = ^RandomBuffer;


var
  i, z: integer;
  zbuffer: randombuffer;

Function swftGetEntropySynchronized(ybuffer: xbuffer; y: longword): integer; stdcall; external 'C:\tools\windows-x86\SwiftRNG.dll';

begin
  try
    z := swftGetEntropySynchronized(@zbuffer, randomNumberCount);
    writeln('status = ', z);

     if z=0 then begin

    for i:=0 to randomNumberCount-1 do
      writeln('randombyte[',i,'] = ',zbuffer[i]);

      end

      else writeln('error occurred in SwftRNG');


    readln;
  except
    on E: Exception do
      writeln(E.ClassName, ': ', E.Message);
  end;

end.