Skip to content

Commit 388569c

Browse files
committed
Introduce loadable pseudo-random number generators.
N.B. The PRNG interface introduced here is subject to review and may change. PRNGs are per-thread and may be changed with the new loadrng() standard function. Two PRNGs are present: IconEx A reimplementation of the traditional generator as a loadable library. Rabbit A cryptographically strong PRNG from the eSTREAM project. Other PRNGs -- probably RanLux and the Mersenne Twister -- will follow.
1 parent dc18501 commit 388569c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+10167
-18
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
;;
8181
fedora*)
8282
dnf -y update
83-
dnf -y install gcc make
83+
dnf -y install gcc make diffutils
8484
;;
8585
centos*)
8686
yum update -y

doc/utr/utr-prng/larson.jpg

12.9 KB
Loading

doc/utr/utr-prng/utr-prng.tex

Lines changed: 2305 additions & 0 deletions
Large diffs are not rendered by default.

doc/utr/utr-prng/utr.sty

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
% tr.sty
2+
\gdef\@abstract{}\gdef\@trnumber{}
3+
\gdef\@affiliation{University of Idaho\\Department of Computer Science\\Moscow, ID, 83844, USA}
4+
\def\maketitle{\begin{titlepage}
5+
\let\footnotesize\small \let\footnoterule\relax \setcounter{page}{0}
6+
\null
7+
\vfil
8+
\vskip 40pt \begin{center}
9+
{\LARGE\bf \@title \par} \vskip 3em {\large \lineskip .75em
10+
{\bf \@author}
11+
\par}
12+
\vskip 1.0em {\bf Unicon Technical Report: \@trnumber}\par
13+
\vskip 1.0em {\large\bf \@date}
14+
\vskip 5.5em \par
15+
16+
{\bf Abstract}
17+
\begin{quote}
18+
\@abstract
19+
\end{quote}
20+
\vskip 0.8in
21+
{\large\bf
22+
Unicon Project\\
23+
http://unicon.org\\
24+
\ \\
25+
\@affiliation
26+
}
27+
\end{center}
28+
29+
\@thanks
30+
\vfil
31+
\null
32+
\end{titlepage}
33+
\setcounter{footnote}{0} \let\thanks\relax
34+
\gdef\@thanks{}\gdef\@author{}\gdef\@title{}\let\maketitle\relax}
35+
\def\trnumber#1{\gdef\@trnumber{#1}}
36+
\def\abstract#1{\gdef\@abstract{#1}}
37+
\def\affiliation#1{\gdef\@affiliation{#1}}
38+

plugins/README

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
11
Unicon Plugins - February 2017
22
------------------------------
33

4-
This directory is home for Unicon's official shared/loadable objects and their sources. This is where some of the new experimental features are added that eventually could be moved to be part of the language, or those features that are deemed to be nonessential to be added as built-in to the language. Contributions are welcome. If you plan to contribute a new feature in the form of a shared object please follow the guidelines below as this makes it easier for us to integrate them with our build system on various platforms.
4+
This directory is home for Unicon's official shared/loadable objects and their
5+
sources. This is where some of the new experimental features are added that
6+
eventually could be moved to be part of the language, or those features that are
7+
deemed to be nonessential to be added as built-in to the language. Contributions
8+
are welcome. If you plan to contribute a new feature in the form of a shared
9+
object please follow the guidelines below as this makes it easier for us to
10+
integrate them with our build system on various platforms.
511

612
1- Make sure every source file has a licence at the top
713
2- Please use consistent formatting across your source files
814
3- Add rules to the make file to build your shared library
915

16+
Note that, as of August 2019, there are now two different kinds of additional
17+
features:
18+
Conventional plugins, as before.
19+
Random Number Generator (RNG) shared libraries.
20+
21+
The RNG libraries are implemented differently to a conventional plugin and each
22+
library is located in a separate subdirectory of plugins/rngLibraries. The
23+
simplest example is in plugins/rngLibraries/rngIconEx, which contains a
24+
re-implementation of the built-in (Icon) generator as a shared library.
25+
The "Ex" may be interpreted as "External" or "Example" (or both).
26+
27+
Note that, for any shared RNG library to work, your implementation of Unicon
28+
must be built with the symbol RngLibrary defined.

plugins/rngLibraries/Makefile

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
################################################################################
2+
#
3+
# This file is released under the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE
4+
# (LGPL) version 2. The licence may be found in the root directory of the Unicon
5+
# source directory in the file COPYING.
6+
#
7+
################################################################################
8+
#
9+
# Makefile for the rng shared libraries
10+
#
11+
# Don Ward
12+
# March 2021
13+
#
14+
################################################################################
15+
include ../../Makedefs
16+
17+
.PHONY: Pure clean install test testPrograms
18+
19+
TESTPROGS = rngConfidence rngPutGet rngSpeed
20+
UNILIB = $(shell unicon -features | grep "Libraries at" | sed -e "s/Libraries at //")
21+
22+
default: all_prngs
23+
24+
all_prngs:
25+
$(MAKE) -C rngIconEx
26+
$(MAKE) -C rngRbt
27+
28+
test: all_prngs testPrograms
29+
$(MAKE) -C rngIconEx test
30+
$(MAKE) -C rngRbt test
31+
./rngConfidence
32+
33+
testPrograms: $(TESTPROGS)
34+
35+
rngConfidence: rngConfidence.icn
36+
unicon -s $^ -o $@
37+
38+
rngPutGet: rngPutGet.icn
39+
unicon -s $^ -o $@
40+
41+
rngSpeed: rngSpeed.icn
42+
unicon -s $^ -o $@
43+
44+
install: all_prngs
45+
# Each install places a shared library in plugins/lib (a.k.a ../lib)
46+
@$(MAKE) -C rngIconEx install
47+
@$(MAKE) -C rngRbt install
48+
# If Unicon is installed somewhere, place the shared libraries in
49+
# the installed location.
50+
@if test "X$(UNILIB)" != "X" ; then \
51+
cp ../lib/rngIconEx.so $(UNILIB); \
52+
cp ../lib/rngRbt.so $(UNILIB); \
53+
fi
54+
55+
clean:
56+
$(MAKE) -C rngIconEx clean
57+
$(MAKE) -C rngRbt clean
58+
rm -f $(TESTPROGS)
59+
60+
Pure:
61+
$(MAKE) -C rngIconEx Pure
62+
$(MAKE) -C rngRbt Pure
63+
rm -f $(TESTPROGS)
64+

0 commit comments

Comments
 (0)