Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 2837cec
  • /
  • c
  • /
  • shared.h
Raw File Download
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:9c2a0620892c730865097516084100d46609c1b9
directory badge Iframe embedding
swh:1:dir:fed0c944d4de09d9eb9eb6c7631f54d261e98a9a
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
shared.h
/* shared.h: a set of simple functions used by both exponential.h and normal.h */
#pragma once

#include <stdlib.h>
#include <math.h>
#include "MT19937.h"

/* All of the arrays are scaled by 2**63 (not 2**64), so this operation is used 
* to draw uniform values in the ziggurat overhangs*/

#define MAX_INT64   0x7fffffffffffffff
#define RANDOM_INT63() ( Rand++->sl & MAX_INT64 )

/* Test to see if rejection sampling is required in the overhang. See Fig. 2
 * in main text. */

#define _FAST_PRNG_SAMPLE_X(X_j, U) (   *(X_j)*pow(2, 63) + ((X_j)[-1] - *(X_j) )*(U) )
#define _FAST_PRNG_SAMPLE_Y(i,   U) ( Y[(i)-1]*pow(2, 63) + (Y[(i)  ] - Y[(i)-1])*(U) )

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top