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

Raw File Download

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
content badge
swh:1:cnt:f41d3b7eda8ce73fd2325f2a87dcf03da1281e0c

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
(requires biblatex-software package)
Generating citation ...
//
// Created by audemard on 30/11/2020.
//

#ifndef GLUCOSE_RANDOM_H
#define GLUCOSE_RANDOM_H
#include <stdint.h>
namespace Glucose {

struct xorshift128_state {
    uint32_t a, b, c, d;
};


class Random {
    struct xorshift128_state state;
    /* The state array must be initialized to not be all zero */
    uint32_t xorshift128() {
        /* Algorithm "xor128" from p. 5 of Marsaglia, "Xorshift RNGs" */
        uint32_t t = state.d;

        uint32_t const s = state.a;
        state.d          = state.c;
        state.c          = state.b;
        state.b          = s;

        t ^= t << 11;
        t ^= t >> 8;
        return state.a = t ^ s ^ (s >> 19);
    }

   public:
    Random(uint32_t _s) { setSeed(_s); }

    void setSeed(uint32_t _s) {
        state.a = _s & 123479117;
        state.b = _s | 123479117;
        state.c = _s & 62346811819;
        state.d = _s | 62346811819;
    }

    uint32_t nextInt() { return xorshift128(); }

    uint32_t nextInt(int max) { return xorshift128() % max; }

    double nextDouble() { return (double)xorshift128() * (1. / (65536. * 65536.)); }   // Return a double in [0,1)
};

}   // namespace Glucose

#endif   // GLUCOSE_RANDOM_H

back to top

Software Heritage — Copyright (C) 2015–2026, 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— Content policy— Contact— JavaScript license information— Web API