aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2010-05-14 02:48:03 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2010-05-14 02:48:03 +0000
commit2453c05054b69951b301527f1f7b132cff143359 (patch)
treef3d44e029db50178b9914bd7fb7abfb2f54ea008
parent78cc2ee38c931ae2c4718abc1607dcf9fbde4cf8 (diff)
first steps towards porting to template Makefile and debianizing, split up randomix.c into separete files for each objectclass, much left to do
svn path=/trunk/externals/cxc/; revision=13540
-rw-r--r--ENV-help.pd (renamed from reference/ENV-help.pd)0
-rw-r--r--LICENSE.txt (renamed from gpl.txt)0
-rw-r--r--Makefile283
-rw-r--r--README.txt (renamed from README)0
-rw-r--r--VERSION1
-rw-r--r--ascseq-help.pd (renamed from reference/ascseq-help.pd)0
-rw-r--r--ascwave-help.pd (renamed from reference/ascwave-help.pd)0
-rw-r--r--bfilt-help.pd (renamed from reference/bfilt-help.pd)0
-rw-r--r--bfilt2-help.pd (renamed from reference/bfilt2-help.pd)0
-rwxr-xr-xconfigure1961
-rw-r--r--configure.in84
-rw-r--r--cxc-meta.pd9
-rw-r--r--cxc.c (renamed from cx.c)8
-rw-r--r--cxc.h (renamed from cx.h)0
-rw-r--r--delta~-help.pd (renamed from reference/delta~-help.pd)0
-rw-r--r--dist_normal-help.pd (renamed from reference/randomix-help.pd)0
-rw-r--r--dist_normal.c174
-rw-r--r--install-sh251
-rw-r--r--makefile.in62
-rw-r--r--proc-help.pd (renamed from reference/proc-help.pd)0
-rw-r--r--random1-help.pd223
-rw-r--r--random1.c137
-rw-r--r--random1~-help.pd223
-rw-r--r--random1~.c115
-rw-r--r--random_fl-help.pd223
-rw-r--r--random_fl.c129
-rw-r--r--random_fl~-help.pd223
-rw-r--r--random_fl~.c100
-rw-r--r--random_icg-help.pd223
-rw-r--r--random_icg.c173
-rw-r--r--random_icg~-help.pd223
-rw-r--r--random_icg~.c164
-rw-r--r--random_tw-help.pd223
-rw-r--r--random_tw.c181
-rw-r--r--randomix.c874
-rw-r--r--reson~-help.pd (renamed from reference/reson~-help.pd)0
-rw-r--r--serialize-help.pd (renamed from reference/serialize-help.pd)0
-rw-r--r--utime-help.pd (renamed from reference/utime-help.pd)0
38 files changed, 3030 insertions, 3237 deletions
diff --git a/reference/ENV-help.pd b/ENV-help.pd
index 7582c67..7582c67 100644
--- a/reference/ENV-help.pd
+++ b/ENV-help.pd
diff --git a/gpl.txt b/LICENSE.txt
index 5b6e7c6..5b6e7c6 100644
--- a/gpl.txt
+++ b/LICENSE.txt
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..5c4cbb9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,283 @@
+## Pd library template version 1.0
+# For instructions on how to use this template, see:
+# http://puredata.info/docs/developer/MakefileTemplate
+LIBRARY_NAME = cxc
+
+# add your .c source files to the SOURCES variable, help files will be
+# included automatically
+SOURCES = ENV.c ascseq.c ascwave.c bfilt.c bfilt2.c binshift.c counter.c cxavgdev.c cxmean.c cxstddev.c delta~.c dist_normal.c hex2dec.c ixprint.c mean~.c prepend.c random1.c random1~.c random_fl.c random_fl~.c random_icg.c random_icg~.c random_tw.c reson~.c split.c utime.c
+
+# For objects that only build on certain platforms, add those to the SOURCES
+# line for the right platforms.
+SOURCES_android =
+SOURCES_cygwin =
+SOURCES_macosx =
+SOURCES_iphoneos =
+SOURCES_linux = proc.c
+SOURCES_windows =
+
+# list all pd objects (i.e. myobject.pd) files here, and their helpfiles will
+# be included automatically
+PDOBJECTS =
+
+# example patches and related files, in the 'examples' subfolder
+EXAMPLES =
+
+# manuals and related files, in the 'manual' subfolder
+MANUAL =
+
+# if you want to include any other files in the source and binary tarballs,
+# list them here. This can be anything from header files, example patches,
+# documentation, etc. README.txt and LICENSE.txt are required and therefore
+# automatically included
+EXTRA_DIST = TODO REFERENCES x_connective_pd034.diff x_connective_pd035.diff cxc.h cxc.c
+
+
+
+#------------------------------------------------------------------------------#
+#
+# you shouldn't need to edit anything below here, if we did it right :)
+#
+#------------------------------------------------------------------------------#
+
+# get library version from meta file
+LIBRARY_VERSION = $(shell sed -n 's|^\#X text [0-9][0-9]* [0-9][0-9]* VERSION \(.*\);|\1|p' $(LIBRARY_NAME)-meta.pd)
+
+# where Pd lives
+PD_PATH = ../../pd
+# where to install the library
+prefix = /usr/local
+libdir = $(prefix)/lib
+pkglibdir = $(libdir)/pd-externals
+objectsdir = $(pkglibdir)
+
+
+INSTALL = install
+INSTALL_FILE = $(INSTALL) -p -m 644
+INSTALL_DIR = $(INSTALL) -p -m 755 -d
+
+CFLAGS = -DPD -I$(PD_PATH)/src -Wall -W -g -DVERSION='"$(LIBRARY_VERSION)"'
+LDFLAGS =
+LIBS =
+ALLSOURCES := $(SOURCES) $(SOURCES_android) $(SOURCES_cygwin) $(SOURCES_macosx) \
+ $(SOURCES_iphoneos) $(SOURCES_linux) $(SOURCES_windows)
+
+UNAME := $(shell uname -s)
+ifeq ($(UNAME),Darwin)
+ CPU := $(shell uname -p)
+ ifeq ($(CPU),arm) # iPhone/iPod Touch
+ SOURCES += $(SOURCES_iphoneos)
+ EXTENSION = pd_darwin
+ OS = iphoneos
+ IPHONE_BASE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin
+ CC=$(IPHONE_BASE)/gcc
+ CPP=$(IPHONE_BASE)/cpp
+ CXX=$(IPHONE_BASE)/g++
+ ISYSROOT = -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk
+ IPHONE_CFLAGS = -miphoneos-version-min=3.0 $(ISYSROOT) -arch armv6
+ OPT_CFLAGS = -fast -funroll-loops -fomit-frame-pointer
+ CFLAGS := $(IPHONE_CFLAGS) $(OPT_CFLAGS) $(CFLAGS) \
+ -I/Applications/Pd-extended.app/Contents/Resources/include
+ LDFLAGS += -arch armv6 -bundle -undefined dynamic_lookup $(ISYSROOT)
+ LIBS += -lc
+ STRIP = strip -x
+ DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION)
+ DISTBINDIR=$(DISTDIR)-$(OS)
+ else # Mac OS X
+ SOURCES += $(SOURCES_macosx)
+ EXTENSION = pd_darwin
+ OS = macosx
+ OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast
+# build universal 32-bit on 10.4 and 32/64 on newer
+ ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 8)
+ FAT_FLAGS = -arch ppc -arch i386 -mmacosx-version-min=10.4
+ else
+ FAT_FLAGS = -arch ppc -arch i386 -arch x86_64 -mmacosx-version-min=10.4
+ SOURCES += $(SOURCES_iphoneos)
+ endif
+ CFLAGS += $(FAT_FLAGS) -fPIC -I/sw/include \
+ -I/Applications/Pd-extended.app/Contents/Resources/include
+ LDFLAGS += $(FAT_FLAGS) -bundle -undefined dynamic_lookup -L/sw/lib
+ # if the 'pd' binary exists, check the linking against it to aid with stripping
+ LDFLAGS += $(shell test -e $(PD_PATH)/bin/pd && echo -bundle_loader $(PD_PATH)/bin/pd)
+ LIBS += -lc
+ STRIP = strip -x
+ DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION)
+ DISTBINDIR=$(DISTDIR)-$(OS)
+# install into ~/Library/Pd on Mac OS X since /usr/local isn't used much
+ pkglibdir=$(HOME)/Library/Pd
+ endif
+endif
+ifeq ($(UNAME),Linux)
+ SOURCES += $(SOURCES_linux)
+ EXTENSION = pd_linux
+ OS = linux
+ OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
+ CFLAGS += -fPIC
+ LDFLAGS += -Wl,--export-dynamic -shared -fPIC
+ LIBS += -lc
+ STRIP = strip --strip-unneeded -R .note -R .comment
+ DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION)
+ DISTBINDIR=$(DISTDIR)-$(OS)-$(shell uname -m)
+endif
+ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME)))
+ SOURCES += $(SOURCES_cygwin)
+ EXTENSION = dll
+ OS = cygwin
+ OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
+ CFLAGS +=
+ LDFLAGS += -Wl,--export-dynamic -shared -L$(PD_PATH)/src
+ LIBS += -lc -lpd
+ STRIP = strip --strip-unneeded -R .note -R .comment
+ DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION)
+ DISTBINDIR=$(DISTDIR)-$(OS)
+endif
+ifeq (MINGW,$(findstring MINGW,$(UNAME)))
+ SOURCES += $(SOURCES_windows)
+ EXTENSION = dll
+ OS = windows
+ OPT_CFLAGS = -O3 -funroll-loops -fomit-frame-pointer -march=i686 -mtune=pentium4
+ CFLAGS += -mms-bitfields
+ LDFLAGS += -s -shared -Wl,--enable-auto-import
+ LIBS += -L$(PD_PATH)/src -L$(PD_PATH)/bin -L$(PD_PATH)/obj -lpd -lwsock32 -lkernel32 -luser32 -lgdi32
+ STRIP = strip --strip-unneeded -R .note -R .comment
+ DISTDIR=$(LIBRARY_NAME)-$(LIBRARY_VERSION)
+ DISTBINDIR=$(DISTDIR)-$(OS)
+endif
+
+CFLAGS += $(OPT_CFLAGS)
+
+
+.PHONY = install libdir_install single_install install-doc install-exec install-examples install-manual clean dist etags
+
+all: $(SOURCES:.c=.$(EXTENSION))
+
+%.o: %.c
+ $(CC) $(CFLAGS) -o "$*.o" -c "$*.c"
+
+%.$(EXTENSION): %.o
+ $(CC) $(LDFLAGS) -o "$*.$(EXTENSION)" "$*.o" $(LIBS)
+ chmod a-x "$*.$(EXTENSION)"
+
+# this links everything into a single binary file
+$(LIBRARY_NAME): $(SOURCES:.c=.o) $(LIBRARY_NAME).o
+ $(CC) $(LDFLAGS) -o $(LIBRARY_NAME).$(EXTENSION) $(SOURCES:.c=.o) $(LIBRARY_NAME).o $(LIBS)
+ chmod a-x $(LIBRARY_NAME).$(EXTENSION)
+
+
+install: libdir_install
+
+# The meta and help files are explicitly installed to make sure they are
+# actually there. Those files are not optional, then need to be there.
+libdir_install: $(SOURCES:.c=.$(EXTENSION)) install-doc install-examples install-manual
+ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd \
+ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ test -z "$(strip $(SOURCES))" || (\
+ $(INSTALL_FILE) $(SOURCES:.c=.$(EXTENSION)) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME) && \
+ $(STRIP) $(addprefix $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/,$(SOURCES:.c=.$(EXTENSION))))
+ test -z "$(strip $(PDOBJECTS))" || \
+ $(INSTALL_FILE) $(PDOBJECTS) \
+ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+
+# install library linked as single binary
+single_install: $(LIBRARY_NAME) install-doc install-exec
+ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ $(INSTALL_FILE) $(LIBRARY_NAME).$(EXTENSION) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ $(STRIP) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/$(LIBRARY_NAME).$(EXTENSION)
+
+install-doc:
+ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ test -z "$(strip $(SOURCES))" || \
+ $(INSTALL_FILE) $(SOURCES:.c=-help.pd) \
+ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ test -z "$(strip $(PDOBJECTS))" || \
+ $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) \
+ $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)
+ $(INSTALL_FILE) README.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/README.txt
+ $(INSTALL_FILE) LICENSE.txt $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/LICENSE.txt
+
+install-examples:
+ test -z "$(strip $(EXAMPLES))" || \
+ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples && \
+ for file in $(EXAMPLES); do \
+ $(INSTALL_FILE) examples/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/examples; \
+ done
+
+install-manual:
+ test -z "$(strip $(MANUAL))" || \
+ $(INSTALL_DIR) $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual && \
+ for file in $(MANUAL); do \
+ $(INSTALL_FILE) manual/$$file $(DESTDIR)$(objectsdir)/$(LIBRARY_NAME)/manual; \
+ done
+
+
+clean:
+ -rm -f -- $(SOURCES:.c=.o)
+ -rm -f -- $(SOURCES:.c=.$(EXTENSION))
+ -rm -f -- $(LIBRARY_NAME).o
+ -rm -f -- $(LIBRARY_NAME).$(EXTENSION)
+
+distclean: clean
+ -rm -f -- $(DISTBINDIR).tar.gz
+ -rm -rf -- $(DISTBINDIR)
+ -rm -f -- $(DISTDIR).tar.gz
+ -rm -rf -- $(DISTDIR)
+
+
+$(DISTBINDIR):
+ $(INSTALL_DIR) $(DISTBINDIR)
+
+libdir: all $(DISTBINDIR)
+ $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTBINDIR)
+ $(INSTALL_FILE) $(SOURCES) $(DISTBINDIR)
+ $(INSTALL_FILE) $(SOURCES:.c=-help.pd) $(DISTBINDIR)
+ test -z "$(strip $(EXTRA_DIST))" || \
+ $(INSTALL_FILE) $(EXTRA_DIST) $(DISTBINDIR)
+# tar --exclude-vcs -czpf $(DISTBINDIR).tar.gz $(DISTBINDIR)
+
+$(DISTDIR):
+ $(INSTALL_DIR) $(DISTDIR)
+
+dist: $(DISTDIR)
+ $(INSTALL_FILE) Makefile $(DISTDIR)
+ $(INSTALL_FILE) README.txt $(DISTDIR)
+ $(INSTALL_FILE) LICENSE.txt $(DISTDIR)
+ $(INSTALL_FILE) $(LIBRARY_NAME)-meta.pd $(DISTDIR)
+ test -z "$(strip $(ALLSOURCES))" || \
+ $(INSTALL_FILE) $(ALLSOURCES) $(DISTDIR)
+ test -z "$(strip $(ALLSOURCES))" || \
+ $(INSTALL_FILE) $(ALLSOURCES:.c=-help.pd) $(DISTDIR)
+ test -z "$(strip $(PDOBJECTS))" || \
+ $(INSTALL_FILE) $(PDOBJECTS) $(DISTDIR)
+ test -z "$(strip $(PDOBJECTS))" || \
+ $(INSTALL_FILE) $(PDOBJECTS:.pd=-help.pd) $(DISTDIR)
+ test -z "$(strip $(EXTRA_DIST))" || \
+ $(INSTALL_FILE) $(EXTRA_DIST) $(DISTDIR)
+ test -z "$(strip $(EXAMPLES))" || \
+ $(INSTALL_DIR) $(DISTDIR)/examples && \
+ for file in $(EXAMPLES); do \
+ $(INSTALL_FILE) examples/$$file $(DISTDIR)/examples; \
+ done
+ test -z "$(strip $(MANUAL))" || \
+ $(INSTALL_DIR) $(DISTDIR)/manual && \
+ for file in $(MANUAL); do \
+ $(INSTALL_FILE) manual/$$file $(DISTDIR)/manual; \
+ done
+ tar --exclude-vcs -czpf $(DISTDIR).tar.gz $(DISTDIR)
+
+
+etags:
+ etags *.h $(SOURCES) ../../pd/src/*.[ch] /usr/include/*.h /usr/include/*/*.h
+
+showsetup:
+ @echo "PD_PATH: $(PD_PATH)"
+ @echo "objectsdir: $(objectsdir)"
+ @echo "LIBRARY_NAME: $(LIBRARY_NAME)"
+ @echo "LIBRARY_VERSION: $(LIBRARY_VERSION)"
+ @echo "SOURCES: $(SOURCES)"
+ @echo "PDOBJECTS: $(PDOBJECTS)"
+ @echo "ALLSOURCES: $(ALLSOURCES)"
+ @echo "UNAME: $(UNAME)"
+ @echo "CPU: $(CPU)"
+ @echo "pkglibdir: $(pkglibdir)"
diff --git a/README b/README.txt
index 80c9f86..80c9f86 100644
--- a/README
+++ b/README.txt
diff --git a/VERSION b/VERSION
deleted file mode 100644
index e9b8f99..0000000
--- a/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-0.05
diff --git a/reference/ascseq-help.pd b/ascseq-help.pd
index 5038a84..5038a84 100644
--- a/reference/ascseq-help.pd
+++ b/ascseq-help.pd
diff --git a/reference/ascwave-help.pd b/ascwave-help.pd
index bb36502..bb36502 100644
--- a/reference/ascwave-help.pd
+++ b/ascwave-help.pd
diff --git a/reference/bfilt-help.pd b/bfilt-help.pd
index 4be9d45..4be9d45 100644
--- a/reference/bfilt-help.pd
+++ b/bfilt-help.pd
diff --git a/reference/bfilt2-help.pd b/bfilt2-help.pd
index 4be9d45..4be9d45 100644
--- a/reference/bfilt2-help.pd
+++ b/bfilt2-help.pd
diff --git a/configure b/configure
deleted file mode 100755
index 5fd38c5..0000000
--- a/configure
+++ /dev/null
@@ -1,1961 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-for ac_option
-do
-
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file="$ac_optarg" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he)
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes="$ac_optarg" ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries="$ac_optarg" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=cx.c
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:529: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:559: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:610: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:642: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 653 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:684: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:689: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:698: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:717: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:779: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
-do
-# Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:836: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="$ac_prog"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-test -n "$CXX" && break
-done
-test -n "$CXX" || CXX="gcc"
-
-
-echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:868: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
-
-ac_ext=C
-# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cxx_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 879 "configure"
-#include "confdefs.h"
-
-int main(){return(0);}
-EOF
-if { (eval echo configure:884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cxx_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cxx_cross=no
- else
- ac_cv_prog_cxx_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cxx_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6
-if test $ac_cv_prog_cxx_works = no; then
- { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:910: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
-cross_compiling=$ac_cv_prog_cxx_cross
-
-echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:915: checking whether we are using GNU C++" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.C <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:924: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gxx=yes
-else
- ac_cv_prog_gxx=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gxx" 1>&6
-
-if test $ac_cv_prog_gxx = yes; then
- GXX=yes
-else
- GXX=
-fi
-
-ac_test_CXXFLAGS="${CXXFLAGS+set}"
-ac_save_CXXFLAGS="$CXXFLAGS"
-CXXFLAGS=
-echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:943: checking whether ${CXX-g++} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.cc
-if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
- ac_cv_prog_cxx_g=yes
-else
- ac_cv_prog_cxx_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6
-if test "$ac_test_CXXFLAGS" = set; then
- CXXFLAGS="$ac_save_CXXFLAGS"
-elif test $ac_cv_prog_cxx_g = yes; then
- if test "$GXX" = yes; then
- CXXFLAGS="-g -O2"
- else
- CXXFLAGS="-g"
- fi
-else
- if test "$GXX" = yes; then
- CXXFLAGS="-O2"
- else
- CXXFLAGS=
- fi
-fi
-
-
-
-
-
-
-
-
-
-
-echo $ac_n "checking for main in -lc""... $ac_c" 1>&6
-echo "configure:984: checking for main in -lc" >&5
-ac_lib_var=`echo c'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lc $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 992 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo c | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-lc $LIBS"
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
-echo $ac_n "checking for main in -lm""... $ac_c" 1>&6
-echo "configure:1027: checking for main in -lm" >&5
-ac_lib_var=`echo m'_'main | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lm $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1035 "configure"
-#include "confdefs.h"
-
-int main() {
-main()
-; return 0; }
-EOF
-if { (eval echo configure:1042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
- LIBS="-lm $LIBS"
-
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1071: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # This must be in double quotes, not single quotes, because CPP may get
- # substituted into the Makefile and "${CC-cc}" will confuse make.
- CPP="${CC-cc} -E"
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp.
- cat > conftest.$ac_ext <<EOF
-#line 1086 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1092: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -E -traditional-cpp"
- cat > conftest.$ac_ext <<EOF
-#line 1103 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1109: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP="${CC-cc} -nologo -E"
- cat > conftest.$ac_ext <<EOF
-#line 1120 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1126: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-rm -f conftest*
- ac_cv_prog_CPP="$CPP"
-fi
- CPP="$ac_cv_prog_CPP"
-else
- ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1151: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1156 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1164: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- ac_cv_header_stdc=yes
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1181 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1199 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
- :
-else
- rm -rf conftest*
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
- :
-else
- cat > conftest.$ac_ext <<EOF
-#line 1220 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
-EOF
-if { (eval echo configure:1231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
- cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
-fi
-
-for ac_hdr in stdlib.h stdio.h string.h math.h time.h sys/time.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1258: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1263 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1268: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-
-echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1296: checking whether time.h and sys/time.h may both be included" >&5
-if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1301 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-int main() {
-struct tm *tp;
-; return 0; }
-EOF
-if { (eval echo configure:1310: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_header_time=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_header_time=no
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_header_time" 1>&6
-if test $ac_cv_header_time = yes; then
- cat >> confdefs.h <<\EOF
-#define TIME_WITH_SYS_TIME 1
-EOF
-
-fi
-
-
-for ac_hdr in unistd.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1335: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1340 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1345: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-for ac_func in getpagesize
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1374: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1379 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:1427: checking for working mmap" >&5
-if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- ac_cv_func_mmap_fixed_mapped=no
-else
- cat > conftest.$ac_ext <<EOF
-#line 1435 "configure"
-#include "confdefs.h"
-
-/* Thanks to Mike Haertel and Jim Avera for this test.
- Here is a matrix of mmap possibilities:
- mmap private not fixed
- mmap private fixed at somewhere currently unmapped
- mmap private fixed at somewhere already mapped
- mmap shared not fixed
- mmap shared fixed at somewhere currently unmapped
- mmap shared fixed at somewhere already mapped
- For private mappings, we should verify that changes cannot be read()
- back from the file, nor mmap's back from the file at a different
- address. (There have been systems where private was not correctly
- implemented like the infamous i386 svr4.0, and systems where the
- VM page cache was not coherent with the filesystem buffer cache
- like early versions of FreeBSD and possibly contemporary NetBSD.)
- For shared mappings, we should conversely verify that changes get
- propogated back to all the places they're supposed to be.
-
- Grep wants private fixed already mapped.
- The main things grep needs to know about mmap are:
- * does it exist and is it safe to write into the mmap'd area
- * how to use it (BSD variants) */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-/* This mess was copied from the GNU getpagesize.h. */
-#ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
-# include <unistd.h>
-# endif
-
-/* Assume that all systems that can run configure have sys/param.h. */
-# ifndef HAVE_SYS_PARAM_H
-# define HAVE_SYS_PARAM_H 1
-# endif
-
-# ifdef _SC_PAGESIZE
-# define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-# ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-# ifdef EXEC_PAGESIZE
-# define getpagesize() EXEC_PAGESIZE
-# else /* no EXEC_PAGESIZE */
-# ifdef NBPG
-# define getpagesize() NBPG * CLSIZE
-# ifndef CLSIZE
-# define CLSIZE 1
-# endif /* no CLSIZE */
-# else /* no NBPG */
-# ifdef NBPC
-# define getpagesize() NBPC
-# else /* no NBPC */
-# ifdef PAGESIZE
-# define getpagesize() PAGESIZE
-# endif /* PAGESIZE */
-# endif /* no NBPC */
-# endif /* no NBPG */
-# endif /* no EXEC_PAGESIZE */
-# else /* no HAVE_SYS_PARAM_H */
-# define getpagesize() 8192 /* punt totally */
-# endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
-
-#endif /* no HAVE_GETPAGESIZE */
-
-#ifdef __cplusplus
-extern "C" { void *malloc(unsigned); }
-#else
-char *malloc();
-#endif
-
-int
-main()
-{
- char *data, *data2, *data3;
- int i, pagesize;
- int fd;
-
- pagesize = getpagesize();
-
- /*
- * First, make a file with some known garbage in it.
- */
- data = malloc(pagesize);
- if (!data)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- *(data + i) = rand();
- umask(0);
- fd = creat("conftestmmap", 0600);
- if (fd < 0)
- exit(1);
- if (write(fd, data, pagesize) != pagesize)
- exit(1);
- close(fd);
-
- /*
- * Next, try to mmap the file at a fixed address which
- * already has something else allocated at it. If we can,
- * also make sure that we see the same garbage.
- */
- fd = open("conftestmmap", O_RDWR);
- if (fd < 0)
- exit(1);
- data2 = malloc(2 * pagesize);
- if (!data2)
- exit(1);
- data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
- if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_FIXED, fd, 0L))
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data2 + i))
- exit(1);
-
- /*
- * Finally, make sure that changes to the mapped area
- * do not percolate back to the file as seen by read().
- * (This is a bug on some variants of i386 svr4.0.)
- */
- for (i = 0; i < pagesize; ++i)
- *(data2 + i) = *(data2 + i) + 1;
- data3 = malloc(pagesize);
- if (!data3)
- exit(1);
- if (read(fd, data3, pagesize) != pagesize)
- exit(1);
- for (i = 0; i < pagesize; ++i)
- if (*(data + i) != *(data3 + i))
- exit(1);
- close(fd);
- unlink("conftestmmap");
- exit(0);
-}
-
-EOF
-if { (eval echo configure:1575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
- ac_cv_func_mmap_fixed_mapped=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_MMAP 1
-EOF
-
-fi
-
-for ac_func in select socket strerror
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1600: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1605 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
-
-
-LD=ld
-
-if test `uname -s` = Linux;
-then
- LFLAGS="-export_dynamic -shared"
- EXT=pd_linux
- DFLAGS="-DUNIX -DLINUX"
- STRIPFLAGS="--strip-unneeded"
-fi
-
-if test `uname -s` = Darwin;
-then
- LD=cc
- LFLAGS="-bundle -undefined suppress -flat_namespace"
- EXT=pd_darwin
- DFLAGS="-DUNIX -DMACOSX"
- STRIPFLAGS=
-fi
-
-if test `uname -s` = IRIX64;
-then
- LFLAGS="-n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
- -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \
- -shared -rdata_shared"
- EXT=pd_irix6
- DFLAGS="-DUNIX -DIRIX6"
- STRIPFLAGS="--strip-unneeded"
-fi
-
-if test `uname -s` = IRIX32;
-then
- LFLAGS="-o32 -DUNIX -DIRIX -O2
- -shared -rdata_shared"
- EXT=pd_irix5
- DFLAGS="-DUNIX -DIRIX5"
- STRIPFLAGS="--strip-unneeded"
-fi
-
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@CC@%$CC%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@CXX@%$CXX%g
-s%@STK@%$STK%g
-s%@DFLAGS@%$DFLAGS%g
-s%@LFLAGS@%$LFLAGS%g
-s%@EXT@%$EXT%g
-s%@LD@%$LD%g
-s%@STRIPFLAGS@%$STRIPFLAGS%g
-s%@CPP@%$CPP%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
diff --git a/configure.in b/configure.in
deleted file mode 100644
index d17d27c..0000000
--- a/configure.in
+++ /dev/null
@@ -1,84 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(cx.c)
-
-dnl Checks for programs.
-AC_PROG_CC
-AC_PROG_INSTALL
-AC_PROG_CXX
-
-AC_SUBST(STK)
-AC_SUBST(DFLAGS)
-AC_SUBST(LFLAGS)
-AC_SUBST(EXT)
-AC_SUBST(LD)
-AC_SUBST(STRIPFLAGS)
-
-
-dnl Checks for libraries.
-dnl Replace `main' with a function in -lc:
-AC_CHECK_LIB(c, main)
-dnl Replace `main' with a function in -lm:
-AC_CHECK_LIB(m, main)
-dnl Replace `main' with a function in -lpthread:
-dnl AC_CHECK_LIB(pthread, main)
-dnl Replace `main' with a function in -lstk:
-dnl AC_CHECK_LIB(stk, main, STK=yes)
-
-dnl Checks for header files.
-AC_HEADER_STDC
-AC_CHECK_HEADERS(stdlib.h stdio.h string.h math.h time.h sys/time.h)
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_HEADER_TIME
-
-dnl Checks for library functions.
-AC_FUNC_MMAP
-AC_CHECK_FUNCS(select socket strerror)
-
-
-LD=ld
-
-dnl
-dnl OK, checks for machines are here now
-dnl
-if test `uname -s` = Linux;
-then
- LFLAGS="-export_dynamic -shared"
- EXT=pd_linux
- DFLAGS="-DUNIX -DLINUX"
- STRIPFLAGS="--strip-unneeded"
-fi
-
-dnl This should use '-bundle_loader /path/to/pd/bin/pd' instead of'-undefined suppress'
-dnl then strip might do something
-if test `uname -s` = Darwin;
-then
- LD=cc
- LFLAGS="-bundle -undefined suppress -flat_namespace"
- EXT=pd_darwin
- DFLAGS="-DUNIX -DMACOSX"
- STRIPFLAGS=
-fi
-
-if test `uname -s` = IRIX64;
-then
- LFLAGS="-n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
- -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \
- -shared -rdata_shared"
- EXT=pd_irix6
- DFLAGS="-DUNIX -DIRIX6"
- STRIPFLAGS="--strip-unneeded"
-fi
-
-if test `uname -s` = IRIX32;
-then
- LFLAGS="-o32 -DUNIX -DIRIX -O2
- -shared -rdata_shared"
- EXT=pd_irix5
- DFLAGS="-DUNIX -DIRIX5"
- STRIPFLAGS="--strip-unneeded"
-fi
-
-
-
-AC_OUTPUT(makefile)
diff --git a/cxc-meta.pd b/cxc-meta.pd
new file mode 100644
index 0000000..deea13f
--- /dev/null
+++ b/cxc-meta.pd
@@ -0,0 +1,9 @@
+#N canvas 10 10 200 200 10;
+#N canvas 20 20 420 300 META 0;
+#X text 10 10 META this is a prototype of a libdir meta file;
+#X text 10 30 NAME cxc;
+#X text 10 50 AUTHOR jdl@xdv.org;
+#X text 10 70 DESCRIPTION library of randoms, averages, and system tools;
+#X text 10 90 LICENSE ;
+#X text 10 110 VERSION 0.5;
+#X restore 10 10 pd META;
diff --git a/cx.c b/cxc.c
index ee725b8..25717ed 100644
--- a/cx.c
+++ b/cxc.c
@@ -1,6 +1,6 @@
#ifndef VERSION
-#define VERSION "0.04"
+#define VERSION "0.05"
#endif
#ifndef __DATE__
@@ -8,7 +8,7 @@
#endif
#include <m_pd.h>
-#include "cx.h"
+#include "cxc.h"
typedef struct _cxc
{
@@ -31,7 +31,7 @@ void bfilt2_setup();
//void testy_tilde_setup();
//void garlic_tilde_setup();
void counter_setup();
-void reson_setup();
+void reson_tilde_setup();
//void serialize_setup();
void prepend_setup();
void split_setup();
@@ -78,7 +78,7 @@ void cxc_setup(void)
/* dumpOSC_setup(); */
/* routeOSC_setup(); */
counter_setup();
- reson_setup();
+ reson_tilde_setup();
//serialize_setup();
prepend_setup();
split_setup();
diff --git a/cx.h b/cxc.h
index 11cb10e..11cb10e 100644
--- a/cx.h
+++ b/cxc.h
diff --git a/reference/delta~-help.pd b/delta~-help.pd
index 7f0bf8b..7f0bf8b 100644
--- a/reference/delta~-help.pd
+++ b/delta~-help.pd
diff --git a/reference/randomix-help.pd b/dist_normal-help.pd
index d913f39..d913f39 100644
--- a/reference/randomix-help.pd
+++ b/dist_normal-help.pd
diff --git a/dist_normal.c b/dist_normal.c
new file mode 100644
index 0000000..7847745
--- /dev/null
+++ b/dist_normal.c
@@ -0,0 +1,174 @@
+/*
+ (c) 2002:cxc@web.fm
+ randomix: various PRNG's
+ code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html
+ let's check it out
+ */
+
+#include <m_pd.h>
+#include <stdlib.h>
+#include <math.h>
+
+#define SMALLEST_RANGE .0001
+
+#ifndef RAND_MAX
+#define RAND_MAX 2147483647
+#endif
+
+static int makeseed(void)
+{
+ static unsigned int random1_nextseed = 1489853723;
+ random1_nextseed = random1_nextseed * 435898247 + 938284287;
+ return (random1_nextseed & 0x7fffffff);
+}
+
+static int rand_random_fl(seed) {
+ int q;
+ double state;
+
+ /* The following parameters are recommended settings based on research
+ uncomment the one you want. */
+
+ double a = 1389796, m = RAND_MAX;
+ /* static double a = 950975, m = 2147483647; */
+ /* static double a = 3467255, m = 21474836472; */
+ /* static double a = 657618, m = 4294967291; */
+ /* static double a = 93167, m = 4294967291; */
+ /* static double a = 1345659, m = 4294967291; */
+
+ state = seed;
+ state *= a;
+ q = state / m;
+ state -= q*m;
+ return state;
+}
+
+/* -------------------------- dist_normal ------------------------------ */
+/* Generate a normal random variable with mean 0 and standard deviation
+ of 1. To adjust to some other distribution, multiply by the standard
+ deviation and add the mean. Box-Muller method
+ note: rand() is a function that returns a uniformly distributed random
+ number from 0 to RAND_MAX
+*/
+
+static t_class *dist_normal_class;
+
+typedef struct _dist_normal
+{
+ t_object x_obj;
+ t_float x_mn; // mean
+ t_float x_dv; // deviation
+ t_float x_u1;
+ t_float x_u2;
+
+ t_float x_f; // lower limit
+ t_float x_g; // upper limit
+ unsigned int x_state; // current seed
+} t_dist_normal;
+
+static void *dist_normal_new(t_floatarg mn, t_floatarg dv)
+{
+ t_dist_normal *x = (t_dist_normal *)pd_new(dist_normal_class);
+ x->x_mn = (mn) ? mn : 0;
+ x->x_dv = (dv) ? dv : 1;
+ x->x_u1 = 13;
+ x->x_u2 = 1000;
+ x->x_f = 0;
+ x->x_g = RAND_MAX;
+ //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g);
+ x->x_state = makeseed();
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
+ // inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2"));
+ //outlet_new(&x->x_obj, &s_float);
+ outlet_new(&x->x_obj, 0);
+ return (x);
+}
+
+static double dist_normal_rand(t_dist_normal *x)
+{
+ int n = x->x_f;
+ double nval;
+ double m;
+
+ m = (double)RAND_MAX * 2;
+
+ // post("cxc/randomix.c: x_state: %d",x->x_state);
+ x->x_state = rand_random_fl(x->x_state);
+ //nval = ((double)x->x_state / m) * (double)(x->x_g - x->x_f) + (double)x->x_f;
+ nval = (double)x->x_state;
+ return (nval);
+}
+
+static void dist_normal_doit(t_dist_normal *x)
+{
+ static double V2, fac;
+ static int phase = 0;
+ double S, Z, U1, U2, V1;
+
+ if (phase)
+ Z = V2 * fac;
+ else
+ {
+ do {
+/* U1 = (double)rand() / RAND_MAX; */
+/* U2 = (double)rand() / RAND_MAX; */
+ U1 = (double)dist_normal_rand(x) / RAND_MAX;
+ U2 = (double)dist_normal_rand(x) / RAND_MAX;
+
+ // post("cxc/randomix.c: test %f %f %f %f", x->x_u1, x->x_u2, U1, U2);
+
+ V1 = 2 * U1 - 1;
+ V2 = 2 * U2 - 1;
+ S = V1 * V1 + V2 * V2;
+ } while(S >= 1);
+
+ fac = sqrt (-2 * log(S) / S);
+ Z = V1 * fac;
+ }
+
+ phase = 1 - phase;
+
+ //return Z;
+ outlet_float(x->x_obj.ob_outlet, Z);
+}
+
+static void dist_normal_bang(t_dist_normal *x)
+{
+/* post("cxc/randomix.c: dist_normal banged"); */
+/* post("cxc/randomix.c: RAND_MAX: %d",RAND_MAX); */
+/* post("cxc/randomix.c: test: %f %f", x->x_u1, x->x_u2); */
+ dist_normal_doit(x);
+}
+
+void dist_normal_low(t_dist_normal *x, t_floatarg mn)
+{
+ x->x_mn = mn;
+}
+
+void dist_normal_upp(t_dist_normal *x, t_floatarg dv)
+{
+ x->x_dv = dv;
+}
+
+void dist_normal_float(t_dist_normal *x, t_floatarg r)
+{
+ outlet_float(x->x_obj.ob_outlet, r);
+}
+
+void dist_normal_list(t_dist_normal *x, t_symbol *s, int argc, t_atom *argv)
+{
+ outlet_list(x->x_obj.ob_outlet, s, argc, argv);
+}
+
+void dist_normal_setup(void)
+{
+ dist_normal_class = class_new(gensym("dist_normal"), (t_newmethod)dist_normal_new, 0,
+ sizeof(t_dist_normal), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addbang(dist_normal_class, dist_normal_bang);
+ class_addmethod(dist_normal_class, (t_method)dist_normal_low, gensym("fl1"), A_FLOAT, 0);
+ // class_addmethod(dist_normal_class, (t_method)dist_normal_upp, gensym("fl2"), A_FLOAT, 0);
+ class_addlist (dist_normal_class, dist_normal_list);
+
+/* class_addmethod(dist_normal_class, (t_method)dist_normal_seed, */
+/* gensym("seed"), A_FLOAT, 0); */
+}
diff --git a/install-sh b/install-sh
deleted file mode 100644
index e9de238..0000000
--- a/install-sh
+++ /dev/null
@@ -1,251 +0,0 @@
-#!/bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- chmodcmd=""
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/makefile.in b/makefile.in
deleted file mode 100644
index 163b6e1..0000000
--- a/makefile.in
+++ /dev/null
@@ -1,62 +0,0 @@
-
-EXT = @EXT@
-DEFS = @DFLAGS@ -DHAVE_LIBC=1 -DHAVE_LIBM=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_UNISTD_H=1 -DHAVE_GETPAGESIZE=1 -DHAVE_MMAP=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 -DHAVE_STRERROR=1 -DPD_VERSION_MINOR=36
-CC = @CC@
-CXX = @CXX@
-LD = @LD@
-AFLAGS =
-LFLAGS = @LFLAGS@
-WFLAGS =
-IFLAGS = -I. -I../../pd/src
-PREFIX=@prefix@
-INSTALL_PREFIX=$(PREFIX)
-
-VERSION = \"$(shell cat VERSION)\"
-TARNAME = cxc-$(shell cat VERSION).tar.gz
-
-.SUFFIXES: .$(EXT)
-
-PDCFLAGS = -g -O2 $(DEFS) $(IFLAGS) $(WFLAGS) $(LFLAGS) $(AFLAGS) -DVERSION=$(VERSION)
-CFLAGS = -g -O2 $(DEFS) $(IFLAGS) $(WFLAGS) -DVERSION=$(VERSION)
-CXXFLAGS = $(CFLAGS)
-
-LIBS = -lc -lm
-#LIBS = -lpthread -lm -lc
-SOURCES = ENV.c ascseq.c ascwave.c bangfilt.c bangfilt2.c binshift.c counter.c cx.c ixprint.c mean.c utime.c prepend.c proc.c randomix.c reson~.c sigdelta.c split.c
-TARGETS = $(SOURCES:.c=.$(EXT))
-
-# all: $(TARGETS)
-all: cxc
-
-cxc: $(TARGETS)
-# cc -c $(CFLAGS) -o cxc.o -DPD cx.c
- $(LD) $(LFLAGS) -o cxc.$(EXT) *.o $(LIBS)
- strip @STRIPFLAGS@ cxc.$(EXT)
-
-clean::
- -rm *.$(EXT) *.o
-
-distclean: clean
- -rm config.cache config.log config.status makefile
-
-
-
-.c.o:
- $(CC) -c -o $@ $(CFLAGS) -DPD $*.c
-
-# cp $@ $*_stat.o
-
-.o.$(EXT):
- $(CC) -o $@ $(PDCFLAGS) -DPD $*.o
-
-
-
-install::
- install -d $(INSTALL_PREFIX)/pd/externs
-# install -m 644 *.$(EXT) $(INSTALL_PREFIX)/pd/externs
- -install -m 644 cxc.$(EXT) $(INSTALL_PREFIX)/pd/externs
- install -m 644 reference/*.pd $(INSTALL_PREFIX)/pd/doc/5.reference
-
-
-dist: distclean
- (cd ..;tar czvf $(TARNAME) cxc)
diff --git a/reference/proc-help.pd b/proc-help.pd
index 65411ae..65411ae 100644
--- a/reference/proc-help.pd
+++ b/proc-help.pd
diff --git a/random1-help.pd b/random1-help.pd
new file mode 100644
index 0000000..d913f39
--- /dev/null
+++ b/random1-help.pd
@@ -0,0 +1,223 @@
+#N canvas 33 162 966 505 10;
+#X msg 197 150 bang;
+#X floatatom 244 150 5 0 0 0 - - -;
+#X floatatom 197 218 10 0 0 0 - - -;
+#X floatatom 53 162 5 0 0 0 - - -;
+#X msg 54 111 bang;
+#X floatatom 289 152 5 0 0 0 - - -;
+#X obj 53 135 random 100;
+#X msg 427 151 bang;
+#X floatatom 474 151 5 0 0 0 - - -;
+#X floatatom 427 219 10 0 0 0 - - -;
+#X floatatom 519 153 5 0 0 0 - - -;
+#X obj 196 183 random1 0 1;
+#X obj 426 184 random_fl 0 1;
+#X msg 672 152 bang;
+#X floatatom 719 152 5 0 0 0 - - -;
+#X floatatom 672 220 10 0 0 0 - - -;
+#X floatatom 764 154 5 0 0 0 - - -;
+#X obj 671 185 random_icg 0 1;
+#X msg 197 276 bang;
+#X floatatom 244 276 5 0 0 0 - - -;
+#X floatatom 197 344 10 0 0 0 - - -;
+#X floatatom 289 278 5 0 0 0 - - -;
+#X text 193 251 random_icg lowerlimit \, upperlimit;
+#X msg 368 288 help;
+#X text 253 10 the random number generatorse;
+#X obj 539 406 dist_normal;
+#X msg 540 356 bang;
+#X obj 579 357 metro 100;
+#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0
+1;
+#X obj 196 309 random_tw 0 1;
+#X floatatom 637 334 5 0 0 0 - - -;
+#N canvas 0 0 600 400 streamview 0;
+#N canvas 0 0 450 300 graph2 0;
+#X array randstream 100 float 0;
+#X coords 0 2 99 -2 200 140 1;
+#X restore 92 222 graph;
+#X obj 146 144 tabwrite randstream;
+#X obj 200 63 count;
+#X obj 200 88 % 100;
+#X obj 156 28 t f b;
+#X obj 49 15 inlet;
+#X connect 2 0 3 0;
+#X connect 3 0 1 1;
+#X connect 4 0 1 0;
+#X connect 4 1 2 0;
+#X connect 5 0 4 0;
+#X restore 570 433 pd streamview;
+#N canvas 306 24 679 400 distview 0;
+#N canvas 0 0 450 300 graph1 0;
+#X array randview1 100 float 0;
+#X coords 0 200 99 0 400 200 1;
+#X restore 248 31 graph;
+#X obj 28 26 inlet;
+#X obj 45 355 tabwrite randview1;
+#X obj 136 201 * 100;
+#X obj 136 225 int;
+#X obj 136 153 + 2;
+#X obj 45 280 tabread randview1;
+#X obj 136 176 / 4;
+#X obj 136 250 t f f;
+#X obj 45 304 t f b;
+#X obj 45 329 + 1;
+#X obj 136 129 t f;
+#X connect 1 0 11 0;
+#X connect 3 0 4 0;
+#X connect 4 0 8 0;
+#X connect 5 0 7 0;
+#X connect 6 0 9 0;
+#X connect 7 0 3 0;
+#X connect 8 0 6 0;
+#X connect 8 1 2 1;
+#X connect 9 0 10 0;
+#X connect 10 0 2 0;
+#X connect 11 0 5 0;
+#X restore 550 458 pd distview;
+#X obj 540 381 t b;
+#X floatatom 477 430 5 0 0 0 - - -;
+#N canvas 0 0 600 400 seedit 0;
+#X msg 284 154 seed \$1;
+#X obj 284 107 utime;
+#X msg 304 74 bang;
+#X obj 254 28 loadbang;
+#X obj 284 130 * 1e+06;
+#X obj 360 167 until;
+#X msg 455 156 bang;
+#X obj 359 194 random 2.14748e+08;
+#X msg 359 267 seed \$1;
+#X msg 385 294 seed \$1;
+#X msg 412 318 seed \$1;
+#X msg 439 267 seed \$1;
+#X msg 466 293 seed \$1;
+#X obj 254 50 t b b;
+#X obj 195 155 print seed1;
+#X obj 143 360 outlet;
+#X obj 204 361 outlet;
+#X obj 264 361 outlet;
+#X obj 317 361 outlet;
+#X obj 367 361 outlet;
+#X text 35 9 seed one random obj \, which generates the seeds for all
+the others.;
+#X obj 359 218 serialize 6;
+#X msg 360 140 6;
+#X obj 359 242 unpack f f f f f f;
+#X msg 485 317 seed \$1;
+#X obj 420 359 outlet;
+#X connect 0 0 7 0;
+#X connect 1 1 4 0;
+#X connect 2 0 1 0;
+#X connect 3 0 13 0;
+#X connect 4 0 0 0;
+#X connect 4 0 14 0;
+#X connect 5 0 7 0;
+#X connect 6 0 7 0;
+#X connect 7 0 21 0;
+#X connect 8 0 15 0;
+#X connect 9 0 16 0;
+#X connect 10 0 17 0;
+#X connect 11 0 18 0;
+#X connect 12 0 19 0;
+#X connect 13 0 22 0;
+#X connect 13 1 1 0;
+#X connect 21 0 23 0;
+#X connect 22 0 5 0;
+#X connect 23 0 8 0;
+#X connect 23 1 9 0;
+#X connect 23 2 10 0;
+#X connect 23 3 11 0;
+#X connect 23 4 12 0;
+#X connect 23 5 24 0;
+#X connect 24 0 25 0;
+#X restore 258 33 pd seedit;
+#X text 37 79 std pd random;
+#X text 197 124 linear congruential generator;
+#X text 197 77 creation arguments for the extra randoms are:;
+#X text 205 92 <range-min \, range-max> \, defaults to 0 respectively
+RAND_MAX;
+#X text 545 17 see also:;
+#X obj 545 40 utime;
+#X text 428 129 another lcg method ..;
+#X text 668 127 inverse linear congruential generator;
+#X text 536 249 normal distribution mean 0 and dist 1;
+#X text 536 264 right now it uses random1 for the actual rand values
+;
+#X text 537 278 but later on it should take one of the randoms as creation
+argument \, so yu can specify which generator is being used.;
+#X text 198 106 they all output floats);
+#X text 540 311 also \, there is some burst at the upper and lower
+limits;
+#N canvas 622 685 592 356 signalversions 1;
+#X obj 68 131 random1~;
+#X obj 368 239 tabwrite~ randomix_test;
+#N canvas 0 0 450 300 graph1 0;
+#X array randomix_test 64 float 1;
+#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236
+0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908
+0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915
+-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131
+-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501
+-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181
+-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187
+-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429
+0.0862183 -0.995607 0.585034 0.205198 -0.337256;
+#X coords 0 1 63 -1 200 140 1;
+#X restore 351 23 graph;
+#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X floatatom 440 184 5 0 0 0 - - -;
+#X obj 382 201 metro 100;
+#X msg 342 201 bang;
+#X obj 73 295 dac~;
+#X floatatom 140 220 5 0 0 0 - - -;
+#X msg 68 58 seed 30000;
+#X obj 142 131 random_fl~;
+#X text 120 98 etc ..;
+#X obj 229 131 random_icg~;
+#X obj 81 241 fader 75;
+#X connect 0 0 13 0;
+#X connect 3 0 5 0;
+#X connect 4 0 5 1;
+#X connect 5 0 1 0;
+#X connect 6 0 1 0;
+#X connect 8 0 13 2;
+#X connect 9 0 0 0;
+#X connect 10 0 13 1;
+#X connect 12 0 1 0;
+#X connect 12 0 13 0;
+#X connect 13 0 7 0;
+#X connect 13 1 7 1;
+#X restore 98 421 pd signalversions;
+#X connect 0 0 11 0;
+#X connect 1 0 11 1;
+#X connect 4 0 6 0;
+#X connect 5 0 11 2;
+#X connect 6 0 3 0;
+#X connect 7 0 12 0;
+#X connect 8 0 12 1;
+#X connect 10 0 12 2;
+#X connect 11 0 2 0;
+#X connect 12 0 9 0;
+#X connect 13 0 17 0;
+#X connect 14 0 17 1;
+#X connect 16 0 17 2;
+#X connect 17 0 15 0;
+#X connect 18 0 29 0;
+#X connect 19 0 29 1;
+#X connect 21 0 29 2;
+#X connect 23 0 29 0;
+#X connect 25 0 31 0;
+#X connect 25 0 32 0;
+#X connect 25 0 34 0;
+#X connect 26 0 33 0;
+#X connect 27 0 33 0;
+#X connect 28 0 27 0;
+#X connect 29 0 20 0;
+#X connect 30 0 27 1;
+#X connect 33 0 25 0;
+#X connect 35 0 6 0;
+#X connect 35 1 11 0;
+#X connect 35 2 12 0;
+#X connect 35 3 17 0;
+#X connect 35 4 29 0;
diff --git a/random1.c b/random1.c
new file mode 100644
index 0000000..5c6c963
--- /dev/null
+++ b/random1.c
@@ -0,0 +1,137 @@
+/*
+ (c) 2002:cxc@web.fm
+ randomix: various PRNG's
+ code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html
+ let's check it out
+ */
+
+#include <m_pd.h>
+#include <stdlib.h>
+#include <math.h>
+
+#define SMALLEST_RANGE .0001
+
+#ifndef RAND_MAX
+#define RAND_MAX 2147483647
+#endif
+
+static int makeseed(void);
+static int rand_random1(int);
+
+static int makeseed(void)
+{
+ static unsigned int random1_nextseed = 1489853723;
+ random1_nextseed = random1_nextseed * 435898247 + 938284287;
+ return (random1_nextseed & 0x7fffffff);
+}
+
+/* -------------------------- random1 ------------------------------ */
+/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */
+static int rand_random1(seed)
+{
+ int state;
+
+ //unsigned int a = 1588635695, m = 4294967291U, q = 2, r = 1117695901;
+ // unsigned int a = 1588635695, m = (RAND_MAX * 2), q = 2, r = 1117695901;
+
+ /* static unsigned int a = 1223106847, m = 4294967291U, q = 3, r = 625646750;*/
+ /* static unsigned int a = 279470273, m = 4294967291U, q = 15, r = 102913196;*/
+ //static unsigned int a = 1583458089, m = 2147483647, q = 1, r = 564025558;
+ static unsigned int a = 784588716, m = 2147483647, q = 2, r = 578306215;
+ /* static unsigned int a = 16807, m = 2147483647, q = 127773, r = 2836; */
+ /* static unsigned int a = 950706376, m = 2147483647, q = 2, r = 246070895; */
+
+ //state = (seed) ? seed : makeseed();
+ state = seed;
+ state = a*(state % q) - r*(state / q);
+ return (state);
+}
+
+/* -------------------------- random1 ------------------------------ */
+/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */
+
+static t_class *random1_class;
+
+typedef struct _random1
+{
+ t_object x_obj;
+ t_float x_f; // lower limit
+ t_float x_g; // upper limit
+ unsigned int x_state; // current seed
+} t_random1;
+
+static void *random1_new(t_floatarg f, t_floatarg g)
+{
+ t_random1 *x = (t_random1 *)pd_new(random1_class);
+ x->x_f = (f) ? f : 0;
+ x->x_g = (g) ? g : RAND_MAX;
+ //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g);
+ x->x_state = makeseed();
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2"));
+ outlet_new(&x->x_obj, &s_float);
+ return (x);
+}
+
+/* -------------------------- random_fl ------------------------------ */
+/* An improved (faster) implementation of the Linear Congruential Generator. Has parameters for 6 separate */
+/* linear congruence formulas. These formulas are different than those above because the previous formulas won't work */
+/* correctly in this implementation. Also, this method only works if your floating point mantissa has at least 53 bits. */
+
+/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */
+/* works if your floating pt. mantissa has at least 53 bits.
+ faster than other versions */
+static void random1_bang(t_random1 *x)
+{
+ int n = x->x_f;
+ double nval;
+ unsigned int m;
+ // this seems weird?
+ m = (RAND_MAX * 2);
+ // unsigned int a = 1588635695, m = 4294967291U, q = 2, r = 1117695901;
+
+ // post("cxc/randomix.c: x_state: %d",x->x_state);
+ x->x_state = rand_random1(x->x_state);
+ nval = ((double)x->x_state / (double)m) * (double)(x->x_g - x->x_f) + (double)x->x_f;
+ // post("cxc/randomix.c: lolim: %f, uplim: %f", x->x_f, x->x_g);
+ // post("cxc/randomix.c: nval: %f",nval);
+ outlet_float(x->x_obj.ob_outlet, nval);
+}
+
+void random1_low(t_random1 *x, t_floatarg f)
+{
+ if(f >= x->x_g) {
+ post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f",
+ SMALLEST_RANGE,
+ x->x_g - SMALLEST_RANGE);
+ x->x_f = x->x_g - SMALLEST_RANGE;
+ } else x->x_f = f;
+}
+
+void random1_upp(t_random1 *x, t_floatarg f)
+{
+ if(f <= x->x_f) {
+ post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f",
+ SMALLEST_RANGE,
+ x->x_f + SMALLEST_RANGE);
+ x->x_g = x->x_f + SMALLEST_RANGE;
+ } else x->x_g = f;
+}
+
+static void random1_seed(t_random1 *x, float f, float glob)
+{
+ x->x_state = f;
+}
+
+void random1_setup(void)
+{
+ random1_class = class_new(gensym("random1"), (t_newmethod)random1_new, 0,
+ sizeof(t_random1), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addbang(random1_class, random1_bang);
+ class_addmethod(random1_class, (t_method)random1_low, gensym("fl1"), A_FLOAT, 0);
+ class_addmethod(random1_class, (t_method)random1_upp, gensym("fl2"), A_FLOAT, 0);
+
+ class_addmethod(random1_class, (t_method)random1_seed,
+ gensym("seed"), A_FLOAT, 0);
+}
+
diff --git a/random1~-help.pd b/random1~-help.pd
new file mode 100644
index 0000000..d913f39
--- /dev/null
+++ b/random1~-help.pd
@@ -0,0 +1,223 @@
+#N canvas 33 162 966 505 10;
+#X msg 197 150 bang;
+#X floatatom 244 150 5 0 0 0 - - -;
+#X floatatom 197 218 10 0 0 0 - - -;
+#X floatatom 53 162 5 0 0 0 - - -;
+#X msg 54 111 bang;
+#X floatatom 289 152 5 0 0 0 - - -;
+#X obj 53 135 random 100;
+#X msg 427 151 bang;
+#X floatatom 474 151 5 0 0 0 - - -;
+#X floatatom 427 219 10 0 0 0 - - -;
+#X floatatom 519 153 5 0 0 0 - - -;
+#X obj 196 183 random1 0 1;
+#X obj 426 184 random_fl 0 1;
+#X msg 672 152 bang;
+#X floatatom 719 152 5 0 0 0 - - -;
+#X floatatom 672 220 10 0 0 0 - - -;
+#X floatatom 764 154 5 0 0 0 - - -;
+#X obj 671 185 random_icg 0 1;
+#X msg 197 276 bang;
+#X floatatom 244 276 5 0 0 0 - - -;
+#X floatatom 197 344 10 0 0 0 - - -;
+#X floatatom 289 278 5 0 0 0 - - -;
+#X text 193 251 random_icg lowerlimit \, upperlimit;
+#X msg 368 288 help;
+#X text 253 10 the random number generatorse;
+#X obj 539 406 dist_normal;
+#X msg 540 356 bang;
+#X obj 579 357 metro 100;
+#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0
+1;
+#X obj 196 309 random_tw 0 1;
+#X floatatom 637 334 5 0 0 0 - - -;
+#N canvas 0 0 600 400 streamview 0;
+#N canvas 0 0 450 300 graph2 0;
+#X array randstream 100 float 0;
+#X coords 0 2 99 -2 200 140 1;
+#X restore 92 222 graph;
+#X obj 146 144 tabwrite randstream;
+#X obj 200 63 count;
+#X obj 200 88 % 100;
+#X obj 156 28 t f b;
+#X obj 49 15 inlet;
+#X connect 2 0 3 0;
+#X connect 3 0 1 1;
+#X connect 4 0 1 0;
+#X connect 4 1 2 0;
+#X connect 5 0 4 0;
+#X restore 570 433 pd streamview;
+#N canvas 306 24 679 400 distview 0;
+#N canvas 0 0 450 300 graph1 0;
+#X array randview1 100 float 0;
+#X coords 0 200 99 0 400 200 1;
+#X restore 248 31 graph;
+#X obj 28 26 inlet;
+#X obj 45 355 tabwrite randview1;
+#X obj 136 201 * 100;
+#X obj 136 225 int;
+#X obj 136 153 + 2;
+#X obj 45 280 tabread randview1;
+#X obj 136 176 / 4;
+#X obj 136 250 t f f;
+#X obj 45 304 t f b;
+#X obj 45 329 + 1;
+#X obj 136 129 t f;
+#X connect 1 0 11 0;
+#X connect 3 0 4 0;
+#X connect 4 0 8 0;
+#X connect 5 0 7 0;
+#X connect 6 0 9 0;
+#X connect 7 0 3 0;
+#X connect 8 0 6 0;
+#X connect 8 1 2 1;
+#X connect 9 0 10 0;
+#X connect 10 0 2 0;
+#X connect 11 0 5 0;
+#X restore 550 458 pd distview;
+#X obj 540 381 t b;
+#X floatatom 477 430 5 0 0 0 - - -;
+#N canvas 0 0 600 400 seedit 0;
+#X msg 284 154 seed \$1;
+#X obj 284 107 utime;
+#X msg 304 74 bang;
+#X obj 254 28 loadbang;
+#X obj 284 130 * 1e+06;
+#X obj 360 167 until;
+#X msg 455 156 bang;
+#X obj 359 194 random 2.14748e+08;
+#X msg 359 267 seed \$1;
+#X msg 385 294 seed \$1;
+#X msg 412 318 seed \$1;
+#X msg 439 267 seed \$1;
+#X msg 466 293 seed \$1;
+#X obj 254 50 t b b;
+#X obj 195 155 print seed1;
+#X obj 143 360 outlet;
+#X obj 204 361 outlet;
+#X obj 264 361 outlet;
+#X obj 317 361 outlet;
+#X obj 367 361 outlet;
+#X text 35 9 seed one random obj \, which generates the seeds for all
+the others.;
+#X obj 359 218 serialize 6;
+#X msg 360 140 6;
+#X obj 359 242 unpack f f f f f f;
+#X msg 485 317 seed \$1;
+#X obj 420 359 outlet;
+#X connect 0 0 7 0;
+#X connect 1 1 4 0;
+#X connect 2 0 1 0;
+#X connect 3 0 13 0;
+#X connect 4 0 0 0;
+#X connect 4 0 14 0;
+#X connect 5 0 7 0;
+#X connect 6 0 7 0;
+#X connect 7 0 21 0;
+#X connect 8 0 15 0;
+#X connect 9 0 16 0;
+#X connect 10 0 17 0;
+#X connect 11 0 18 0;
+#X connect 12 0 19 0;
+#X connect 13 0 22 0;
+#X connect 13 1 1 0;
+#X connect 21 0 23 0;
+#X connect 22 0 5 0;
+#X connect 23 0 8 0;
+#X connect 23 1 9 0;
+#X connect 23 2 10 0;
+#X connect 23 3 11 0;
+#X connect 23 4 12 0;
+#X connect 23 5 24 0;
+#X connect 24 0 25 0;
+#X restore 258 33 pd seedit;
+#X text 37 79 std pd random;
+#X text 197 124 linear congruential generator;
+#X text 197 77 creation arguments for the extra randoms are:;
+#X text 205 92 <range-min \, range-max> \, defaults to 0 respectively
+RAND_MAX;
+#X text 545 17 see also:;
+#X obj 545 40 utime;
+#X text 428 129 another lcg method ..;
+#X text 668 127 inverse linear congruential generator;
+#X text 536 249 normal distribution mean 0 and dist 1;
+#X text 536 264 right now it uses random1 for the actual rand values
+;
+#X text 537 278 but later on it should take one of the randoms as creation
+argument \, so yu can specify which generator is being used.;
+#X text 198 106 they all output floats);
+#X text 540 311 also \, there is some burst at the upper and lower
+limits;
+#N canvas 622 685 592 356 signalversions 1;
+#X obj 68 131 random1~;
+#X obj 368 239 tabwrite~ randomix_test;
+#N canvas 0 0 450 300 graph1 0;
+#X array randomix_test 64 float 1;
+#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236
+0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908
+0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915
+-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131
+-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501
+-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181
+-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187
+-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429
+0.0862183 -0.995607 0.585034 0.205198 -0.337256;
+#X coords 0 1 63 -1 200 140 1;
+#X restore 351 23 graph;
+#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X floatatom 440 184 5 0 0 0 - - -;
+#X obj 382 201 metro 100;
+#X msg 342 201 bang;
+#X obj 73 295 dac~;
+#X floatatom 140 220 5 0 0 0 - - -;
+#X msg 68 58 seed 30000;
+#X obj 142 131 random_fl~;
+#X text 120 98 etc ..;
+#X obj 229 131 random_icg~;
+#X obj 81 241 fader 75;
+#X connect 0 0 13 0;
+#X connect 3 0 5 0;
+#X connect 4 0 5 1;
+#X connect 5 0 1 0;
+#X connect 6 0 1 0;
+#X connect 8 0 13 2;
+#X connect 9 0 0 0;
+#X connect 10 0 13 1;
+#X connect 12 0 1 0;
+#X connect 12 0 13 0;
+#X connect 13 0 7 0;
+#X connect 13 1 7 1;
+#X restore 98 421 pd signalversions;
+#X connect 0 0 11 0;
+#X connect 1 0 11 1;
+#X connect 4 0 6 0;
+#X connect 5 0 11 2;
+#X connect 6 0 3 0;
+#X connect 7 0 12 0;
+#X connect 8 0 12 1;
+#X connect 10 0 12 2;
+#X connect 11 0 2 0;
+#X connect 12 0 9 0;
+#X connect 13 0 17 0;
+#X connect 14 0 17 1;
+#X connect 16 0 17 2;
+#X connect 17 0 15 0;
+#X connect 18 0 29 0;
+#X connect 19 0 29 1;
+#X connect 21 0 29 2;
+#X connect 23 0 29 0;
+#X connect 25 0 31 0;
+#X connect 25 0 32 0;
+#X connect 25 0 34 0;
+#X connect 26 0 33 0;
+#X connect 27 0 33 0;
+#X connect 28 0 27 0;
+#X connect 29 0 20 0;
+#X connect 30 0 27 1;
+#X connect 33 0 25 0;
+#X connect 35 0 6 0;
+#X connect 35 1 11 0;
+#X connect 35 2 12 0;
+#X connect 35 3 17 0;
+#X connect 35 4 29 0;
diff --git a/random1~.c b/random1~.c
new file mode 100644
index 0000000..0c03fd7
--- /dev/null
+++ b/random1~.c
@@ -0,0 +1,115 @@
+/*
+ (c) 2002:cxc@web.fm
+ randomix: various PRNG's
+ code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html
+ let's check it out
+ */
+
+#include <m_pd.h>
+#include <stdlib.h>
+#include <math.h>
+
+#define SMALLEST_RANGE .0001
+
+#ifndef RAND_MAX
+#define RAND_MAX 2147483647
+#endif
+
+static int makeseed(void);
+static int rand_random1(int);
+
+static int makeseed(void)
+{
+ static unsigned int random1_nextseed = 1489853723;
+ random1_nextseed = random1_nextseed * 435898247 + 938284287;
+ return (random1_nextseed & 0x7fffffff);
+}
+
+/* -------------------------- random1 ------------------------------ */
+/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */
+static int rand_random1(seed)
+{
+ int state;
+
+ //unsigned int a = 1588635695, m = 4294967291U, q = 2, r = 1117695901;
+ // unsigned int a = 1588635695, m = (RAND_MAX * 2), q = 2, r = 1117695901;
+
+ /* static unsigned int a = 1223106847, m = 4294967291U, q = 3, r = 625646750;*/
+ /* static unsigned int a = 279470273, m = 4294967291U, q = 15, r = 102913196;*/
+ //static unsigned int a = 1583458089, m = 2147483647, q = 1, r = 564025558;
+ static unsigned int a = 784588716, m = 2147483647, q = 2, r = 578306215;
+ /* static unsigned int a = 16807, m = 2147483647, q = 127773, r = 2836; */
+ /* static unsigned int a = 950706376, m = 2147483647, q = 2, r = 246070895; */
+
+ //state = (seed) ? seed : makeseed();
+ state = seed;
+ state = a*(state % q) - r*(state / q);
+ return (state);
+}
+
+/* -------------------------- random1 ------------------------------ */
+/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */
+
+static t_class *random1_class;
+
+typedef struct _random1
+{
+ t_object x_obj;
+ t_float x_f; // lower limit
+ t_float x_g; // upper limit
+ unsigned int x_state; // current seed
+} t_random1;
+
+/* -------------------------- random1 ------------------------------ */
+/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */
+/* signal version */
+
+static t_class *random1_tilde_class;
+
+typedef struct _random1_tilde
+{
+ t_object x_obj;
+ unsigned int x_state; // current seed
+} t_random1_tilde;
+
+static void *random1_tilde_new()
+{
+ t_random1_tilde *x = (t_random1_tilde *)pd_new(random1_tilde_class);
+ x->x_state = makeseed();
+ outlet_new(&x->x_obj, gensym("signal"));
+ return (x);
+}
+
+static void random1_tilde_seed(t_random1_tilde *x, float f, float glob)
+{
+ x->x_state = f;
+}
+
+static t_int *random1_tilde_perform(t_int *w)
+{
+ t_random1_tilde *x = (t_random1_tilde *)(w[1]);
+ t_float *out = (t_float *)(w[2]);
+ int n = (int)(w[3]);
+
+ while (n--) {
+ // generate new noise sample
+ x->x_state = rand_random1(x->x_state);
+ *out++ = (t_float)x->x_state / RAND_MAX - 1;
+ }
+
+ return (w+4);
+}
+
+static void random1_tilde_dsp(t_random1_tilde *x, t_signal **sp)
+{
+ dsp_add(random1_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
+}
+
+void random1_tilde_setup(void)
+{
+ random1_tilde_class = class_new(gensym("random1~"),
+ (t_newmethod)random1_tilde_new,
+ 0, sizeof(t_random1_tilde), 0, 0);
+ class_addmethod(random1_tilde_class, (t_method)random1_tilde_seed,gensym("seed"), A_FLOAT, 0);
+ class_addmethod(random1_tilde_class, (t_method)random1_tilde_dsp, gensym("dsp"), 0);
+}
diff --git a/random_fl-help.pd b/random_fl-help.pd
new file mode 100644
index 0000000..d913f39
--- /dev/null
+++ b/random_fl-help.pd
@@ -0,0 +1,223 @@
+#N canvas 33 162 966 505 10;
+#X msg 197 150 bang;
+#X floatatom 244 150 5 0 0 0 - - -;
+#X floatatom 197 218 10 0 0 0 - - -;
+#X floatatom 53 162 5 0 0 0 - - -;
+#X msg 54 111 bang;
+#X floatatom 289 152 5 0 0 0 - - -;
+#X obj 53 135 random 100;
+#X msg 427 151 bang;
+#X floatatom 474 151 5 0 0 0 - - -;
+#X floatatom 427 219 10 0 0 0 - - -;
+#X floatatom 519 153 5 0 0 0 - - -;
+#X obj 196 183 random1 0 1;
+#X obj 426 184 random_fl 0 1;
+#X msg 672 152 bang;
+#X floatatom 719 152 5 0 0 0 - - -;
+#X floatatom 672 220 10 0 0 0 - - -;
+#X floatatom 764 154 5 0 0 0 - - -;
+#X obj 671 185 random_icg 0 1;
+#X msg 197 276 bang;
+#X floatatom 244 276 5 0 0 0 - - -;
+#X floatatom 197 344 10 0 0 0 - - -;
+#X floatatom 289 278 5 0 0 0 - - -;
+#X text 193 251 random_icg lowerlimit \, upperlimit;
+#X msg 368 288 help;
+#X text 253 10 the random number generatorse;
+#X obj 539 406 dist_normal;
+#X msg 540 356 bang;
+#X obj 579 357 metro 100;
+#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0
+1;
+#X obj 196 309 random_tw 0 1;
+#X floatatom 637 334 5 0 0 0 - - -;
+#N canvas 0 0 600 400 streamview 0;
+#N canvas 0 0 450 300 graph2 0;
+#X array randstream 100 float 0;
+#X coords 0 2 99 -2 200 140 1;
+#X restore 92 222 graph;
+#X obj 146 144 tabwrite randstream;
+#X obj 200 63 count;
+#X obj 200 88 % 100;
+#X obj 156 28 t f b;
+#X obj 49 15 inlet;
+#X connect 2 0 3 0;
+#X connect 3 0 1 1;
+#X connect 4 0 1 0;
+#X connect 4 1 2 0;
+#X connect 5 0 4 0;
+#X restore 570 433 pd streamview;
+#N canvas 306 24 679 400 distview 0;
+#N canvas 0 0 450 300 graph1 0;
+#X array randview1 100 float 0;
+#X coords 0 200 99 0 400 200 1;
+#X restore 248 31 graph;
+#X obj 28 26 inlet;
+#X obj 45 355 tabwrite randview1;
+#X obj 136 201 * 100;
+#X obj 136 225 int;
+#X obj 136 153 + 2;
+#X obj 45 280 tabread randview1;
+#X obj 136 176 / 4;
+#X obj 136 250 t f f;
+#X obj 45 304 t f b;
+#X obj 45 329 + 1;
+#X obj 136 129 t f;
+#X connect 1 0 11 0;
+#X connect 3 0 4 0;
+#X connect 4 0 8 0;
+#X connect 5 0 7 0;
+#X connect 6 0 9 0;
+#X connect 7 0 3 0;
+#X connect 8 0 6 0;
+#X connect 8 1 2 1;
+#X connect 9 0 10 0;
+#X connect 10 0 2 0;
+#X connect 11 0 5 0;
+#X restore 550 458 pd distview;
+#X obj 540 381 t b;
+#X floatatom 477 430 5 0 0 0 - - -;
+#N canvas 0 0 600 400 seedit 0;
+#X msg 284 154 seed \$1;
+#X obj 284 107 utime;
+#X msg 304 74 bang;
+#X obj 254 28 loadbang;
+#X obj 284 130 * 1e+06;
+#X obj 360 167 until;
+#X msg 455 156 bang;
+#X obj 359 194 random 2.14748e+08;
+#X msg 359 267 seed \$1;
+#X msg 385 294 seed \$1;
+#X msg 412 318 seed \$1;
+#X msg 439 267 seed \$1;
+#X msg 466 293 seed \$1;
+#X obj 254 50 t b b;
+#X obj 195 155 print seed1;
+#X obj 143 360 outlet;
+#X obj 204 361 outlet;
+#X obj 264 361 outlet;
+#X obj 317 361 outlet;
+#X obj 367 361 outlet;
+#X text 35 9 seed one random obj \, which generates the seeds for all
+the others.;
+#X obj 359 218 serialize 6;
+#X msg 360 140 6;
+#X obj 359 242 unpack f f f f f f;
+#X msg 485 317 seed \$1;
+#X obj 420 359 outlet;
+#X connect 0 0 7 0;
+#X connect 1 1 4 0;
+#X connect 2 0 1 0;
+#X connect 3 0 13 0;
+#X connect 4 0 0 0;
+#X connect 4 0 14 0;
+#X connect 5 0 7 0;
+#X connect 6 0 7 0;
+#X connect 7 0 21 0;
+#X connect 8 0 15 0;
+#X connect 9 0 16 0;
+#X connect 10 0 17 0;
+#X connect 11 0 18 0;
+#X connect 12 0 19 0;
+#X connect 13 0 22 0;
+#X connect 13 1 1 0;
+#X connect 21 0 23 0;
+#X connect 22 0 5 0;
+#X connect 23 0 8 0;
+#X connect 23 1 9 0;
+#X connect 23 2 10 0;
+#X connect 23 3 11 0;
+#X connect 23 4 12 0;
+#X connect 23 5 24 0;
+#X connect 24 0 25 0;
+#X restore 258 33 pd seedit;
+#X text 37 79 std pd random;
+#X text 197 124 linear congruential generator;
+#X text 197 77 creation arguments for the extra randoms are:;
+#X text 205 92 <range-min \, range-max> \, defaults to 0 respectively
+RAND_MAX;
+#X text 545 17 see also:;
+#X obj 545 40 utime;
+#X text 428 129 another lcg method ..;
+#X text 668 127 inverse linear congruential generator;
+#X text 536 249 normal distribution mean 0 and dist 1;
+#X text 536 264 right now it uses random1 for the actual rand values
+;
+#X text 537 278 but later on it should take one of the randoms as creation
+argument \, so yu can specify which generator is being used.;
+#X text 198 106 they all output floats);
+#X text 540 311 also \, there is some burst at the upper and lower
+limits;
+#N canvas 622 685 592 356 signalversions 1;
+#X obj 68 131 random1~;
+#X obj 368 239 tabwrite~ randomix_test;
+#N canvas 0 0 450 300 graph1 0;
+#X array randomix_test 64 float 1;
+#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236
+0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908
+0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915
+-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131
+-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501
+-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181
+-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187
+-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429
+0.0862183 -0.995607 0.585034 0.205198 -0.337256;
+#X coords 0 1 63 -1 200 140 1;
+#X restore 351 23 graph;
+#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X floatatom 440 184 5 0 0 0 - - -;
+#X obj 382 201 metro 100;
+#X msg 342 201 bang;
+#X obj 73 295 dac~;
+#X floatatom 140 220 5 0 0 0 - - -;
+#X msg 68 58 seed 30000;
+#X obj 142 131 random_fl~;
+#X text 120 98 etc ..;
+#X obj 229 131 random_icg~;
+#X obj 81 241 fader 75;
+#X connect 0 0 13 0;
+#X connect 3 0 5 0;
+#X connect 4 0 5 1;
+#X connect 5 0 1 0;
+#X connect 6 0 1 0;
+#X connect 8 0 13 2;
+#X connect 9 0 0 0;
+#X connect 10 0 13 1;
+#X connect 12 0 1 0;
+#X connect 12 0 13 0;
+#X connect 13 0 7 0;
+#X connect 13 1 7 1;
+#X restore 98 421 pd signalversions;
+#X connect 0 0 11 0;
+#X connect 1 0 11 1;
+#X connect 4 0 6 0;
+#X connect 5 0 11 2;
+#X connect 6 0 3 0;
+#X connect 7 0 12 0;
+#X connect 8 0 12 1;
+#X connect 10 0 12 2;
+#X connect 11 0 2 0;
+#X connect 12 0 9 0;
+#X connect 13 0 17 0;
+#X connect 14 0 17 1;
+#X connect 16 0 17 2;
+#X connect 17 0 15 0;
+#X connect 18 0 29 0;
+#X connect 19 0 29 1;
+#X connect 21 0 29 2;
+#X connect 23 0 29 0;
+#X connect 25 0 31 0;
+#X connect 25 0 32 0;
+#X connect 25 0 34 0;
+#X connect 26 0 33 0;
+#X connect 27 0 33 0;
+#X connect 28 0 27 0;
+#X connect 29 0 20 0;
+#X connect 30 0 27 1;
+#X connect 33 0 25 0;
+#X connect 35 0 6 0;
+#X connect 35 1 11 0;
+#X connect 35 2 12 0;
+#X connect 35 3 17 0;
+#X connect 35 4 29 0;
diff --git a/random_fl.c b/random_fl.c
new file mode 100644
index 0000000..33c88d3
--- /dev/null
+++ b/random_fl.c
@@ -0,0 +1,129 @@
+/*
+ (c) 2002:cxc@web.fm
+ randomix: various PRNG's
+ code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html
+ let's check it out
+ */
+
+#include <m_pd.h>
+#include <stdlib.h>
+#include <math.h>
+
+#define SMALLEST_RANGE .0001
+
+#ifndef RAND_MAX
+#define RAND_MAX 2147483647
+#endif
+
+static int makeseed(void);
+static int rand_random_fl(int);
+
+static int makeseed(void)
+{
+ static unsigned int random1_nextseed = 1489853723;
+ random1_nextseed = random1_nextseed * 435898247 + 938284287;
+ return (random1_nextseed & 0x7fffffff);
+}
+
+static int rand_random_fl(seed) {
+ int q;
+ double state;
+
+ /* The following parameters are recommended settings based on research
+ uncomment the one you want. */
+
+ double a = 1389796, m = RAND_MAX;
+ /* static double a = 950975, m = 2147483647; */
+ /* static double a = 3467255, m = 21474836472; */
+ /* static double a = 657618, m = 4294967291; */
+ /* static double a = 93167, m = 4294967291; */
+ /* static double a = 1345659, m = 4294967291; */
+
+ state = seed;
+ state *= a;
+ q = state / m;
+ state -= q*m;
+ return state;
+}
+
+/* -------------------------- random_fl ------------------------------ */
+/* An improved (faster) implementation of the Linear Congruential Generator. Has parameters for 6 separate */
+/* linear congruence formulas. These formulas are different than those above because the previous formulas won't work */
+/* correctly in this implementation. Also, this method only works if your floating point mantissa has at least 53 bits. */
+
+/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */
+/* works if your floating pt. mantissa has at least 53 bits.
+ faster than other versions */
+
+static t_class *random_fl_class;
+
+typedef struct _random_fl
+{
+ t_object x_obj;
+ t_float x_f; // lower limit
+ t_float x_g; // upper limit
+ unsigned int x_state; // current seed
+} t_random_fl;
+
+static void *random_fl_new(t_floatarg f, t_floatarg g)
+{
+ t_random_fl *x = (t_random_fl *)pd_new(random_fl_class);
+ x->x_f = (f) ? f : 0;
+ x->x_g = (g) ? g : RAND_MAX;
+ //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g);
+ x->x_state = makeseed();
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2"));
+ outlet_new(&x->x_obj, &s_float);
+ return (x);
+}
+
+void random_fl_bang(t_random_fl *x)
+{
+ int n = x->x_f;
+ int q;
+ double nval;
+ double m;
+
+ m = RAND_MAX;
+ x->x_state = rand_random_fl(x->x_state);
+ nval = ((x->x_state / m) * (double)(x->x_g - x->x_f) + (double)x->x_f);
+ outlet_float(x->x_obj.ob_outlet, nval);
+}
+
+void random_fl_low(t_random_fl *x, t_floatarg f)
+{
+ if(f >= x->x_g) {
+ post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f",
+ SMALLEST_RANGE,
+ x->x_g - SMALLEST_RANGE);
+ x->x_f = x->x_g - SMALLEST_RANGE;
+ } else x->x_f = f;
+}
+
+void random_fl_upp(t_random_fl *x, t_floatarg f)
+{
+ if(f <= x->x_f) {
+ post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f",
+ SMALLEST_RANGE,
+ x->x_f + SMALLEST_RANGE);
+ x->x_g = x->x_f + SMALLEST_RANGE;
+ } else x->x_g = f;
+}
+
+static void random_fl_seed(t_random_fl *x, float f, float glob)
+{
+ x->x_state = f;
+}
+
+void random_fl_setup(void)
+{
+ random_fl_class = class_new(gensym("random_fl"), (t_newmethod)random_fl_new, 0,
+ sizeof(t_random_fl), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addbang(random_fl_class, random_fl_bang);
+ class_addmethod(random_fl_class, (t_method)random_fl_low, gensym("fl1"), A_FLOAT, 0);
+ class_addmethod(random_fl_class, (t_method)random_fl_upp, gensym("fl2"), A_FLOAT, 0);
+
+ class_addmethod(random_fl_class, (t_method)random_fl_seed,
+ gensym("seed"), A_FLOAT, 0);
+}
diff --git a/random_fl~-help.pd b/random_fl~-help.pd
new file mode 100644
index 0000000..d913f39
--- /dev/null
+++ b/random_fl~-help.pd
@@ -0,0 +1,223 @@
+#N canvas 33 162 966 505 10;
+#X msg 197 150 bang;
+#X floatatom 244 150 5 0 0 0 - - -;
+#X floatatom 197 218 10 0 0 0 - - -;
+#X floatatom 53 162 5 0 0 0 - - -;
+#X msg 54 111 bang;
+#X floatatom 289 152 5 0 0 0 - - -;
+#X obj 53 135 random 100;
+#X msg 427 151 bang;
+#X floatatom 474 151 5 0 0 0 - - -;
+#X floatatom 427 219 10 0 0 0 - - -;
+#X floatatom 519 153 5 0 0 0 - - -;
+#X obj 196 183 random1 0 1;
+#X obj 426 184 random_fl 0 1;
+#X msg 672 152 bang;
+#X floatatom 719 152 5 0 0 0 - - -;
+#X floatatom 672 220 10 0 0 0 - - -;
+#X floatatom 764 154 5 0 0 0 - - -;
+#X obj 671 185 random_icg 0 1;
+#X msg 197 276 bang;
+#X floatatom 244 276 5 0 0 0 - - -;
+#X floatatom 197 344 10 0 0 0 - - -;
+#X floatatom 289 278 5 0 0 0 - - -;
+#X text 193 251 random_icg lowerlimit \, upperlimit;
+#X msg 368 288 help;
+#X text 253 10 the random number generatorse;
+#X obj 539 406 dist_normal;
+#X msg 540 356 bang;
+#X obj 579 357 metro 100;
+#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0
+1;
+#X obj 196 309 random_tw 0 1;
+#X floatatom 637 334 5 0 0 0 - - -;
+#N canvas 0 0 600 400 streamview 0;
+#N canvas 0 0 450 300 graph2 0;
+#X array randstream 100 float 0;
+#X coords 0 2 99 -2 200 140 1;
+#X restore 92 222 graph;
+#X obj 146 144 tabwrite randstream;
+#X obj 200 63 count;
+#X obj 200 88 % 100;
+#X obj 156 28 t f b;
+#X obj 49 15 inlet;
+#X connect 2 0 3 0;
+#X connect 3 0 1 1;
+#X connect 4 0 1 0;
+#X connect 4 1 2 0;
+#X connect 5 0 4 0;
+#X restore 570 433 pd streamview;
+#N canvas 306 24 679 400 distview 0;
+#N canvas 0 0 450 300 graph1 0;
+#X array randview1 100 float 0;
+#X coords 0 200 99 0 400 200 1;
+#X restore 248 31 graph;
+#X obj 28 26 inlet;
+#X obj 45 355 tabwrite randview1;
+#X obj 136 201 * 100;
+#X obj 136 225 int;
+#X obj 136 153 + 2;
+#X obj 45 280 tabread randview1;
+#X obj 136 176 / 4;
+#X obj 136 250 t f f;
+#X obj 45 304 t f b;
+#X obj 45 329 + 1;
+#X obj 136 129 t f;
+#X connect 1 0 11 0;
+#X connect 3 0 4 0;
+#X connect 4 0 8 0;
+#X connect 5 0 7 0;
+#X connect 6 0 9 0;
+#X connect 7 0 3 0;
+#X connect 8 0 6 0;
+#X connect 8 1 2 1;
+#X connect 9 0 10 0;
+#X connect 10 0 2 0;
+#X connect 11 0 5 0;
+#X restore 550 458 pd distview;
+#X obj 540 381 t b;
+#X floatatom 477 430 5 0 0 0 - - -;
+#N canvas 0 0 600 400 seedit 0;
+#X msg 284 154 seed \$1;
+#X obj 284 107 utime;
+#X msg 304 74 bang;
+#X obj 254 28 loadbang;
+#X obj 284 130 * 1e+06;
+#X obj 360 167 until;
+#X msg 455 156 bang;
+#X obj 359 194 random 2.14748e+08;
+#X msg 359 267 seed \$1;
+#X msg 385 294 seed \$1;
+#X msg 412 318 seed \$1;
+#X msg 439 267 seed \$1;
+#X msg 466 293 seed \$1;
+#X obj 254 50 t b b;
+#X obj 195 155 print seed1;
+#X obj 143 360 outlet;
+#X obj 204 361 outlet;
+#X obj 264 361 outlet;
+#X obj 317 361 outlet;
+#X obj 367 361 outlet;
+#X text 35 9 seed one random obj \, which generates the seeds for all
+the others.;
+#X obj 359 218 serialize 6;
+#X msg 360 140 6;
+#X obj 359 242 unpack f f f f f f;
+#X msg 485 317 seed \$1;
+#X obj 420 359 outlet;
+#X connect 0 0 7 0;
+#X connect 1 1 4 0;
+#X connect 2 0 1 0;
+#X connect 3 0 13 0;
+#X connect 4 0 0 0;
+#X connect 4 0 14 0;
+#X connect 5 0 7 0;
+#X connect 6 0 7 0;
+#X connect 7 0 21 0;
+#X connect 8 0 15 0;
+#X connect 9 0 16 0;
+#X connect 10 0 17 0;
+#X connect 11 0 18 0;
+#X connect 12 0 19 0;
+#X connect 13 0 22 0;
+#X connect 13 1 1 0;
+#X connect 21 0 23 0;
+#X connect 22 0 5 0;
+#X connect 23 0 8 0;
+#X connect 23 1 9 0;
+#X connect 23 2 10 0;
+#X connect 23 3 11 0;
+#X connect 23 4 12 0;
+#X connect 23 5 24 0;
+#X connect 24 0 25 0;
+#X restore 258 33 pd seedit;
+#X text 37 79 std pd random;
+#X text 197 124 linear congruential generator;
+#X text 197 77 creation arguments for the extra randoms are:;
+#X text 205 92 <range-min \, range-max> \, defaults to 0 respectively
+RAND_MAX;
+#X text 545 17 see also:;
+#X obj 545 40 utime;
+#X text 428 129 another lcg method ..;
+#X text 668 127 inverse linear congruential generator;
+#X text 536 249 normal distribution mean 0 and dist 1;
+#X text 536 264 right now it uses random1 for the actual rand values
+;
+#X text 537 278 but later on it should take one of the randoms as creation
+argument \, so yu can specify which generator is being used.;
+#X text 198 106 they all output floats);
+#X text 540 311 also \, there is some burst at the upper and lower
+limits;
+#N canvas 622 685 592 356 signalversions 1;
+#X obj 68 131 random1~;
+#X obj 368 239 tabwrite~ randomix_test;
+#N canvas 0 0 450 300 graph1 0;
+#X array randomix_test 64 float 1;
+#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236
+0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908
+0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915
+-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131
+-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501
+-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181
+-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187
+-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429
+0.0862183 -0.995607 0.585034 0.205198 -0.337256;
+#X coords 0 1 63 -1 200 140 1;
+#X restore 351 23 graph;
+#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X floatatom 440 184 5 0 0 0 - - -;
+#X obj 382 201 metro 100;
+#X msg 342 201 bang;
+#X obj 73 295 dac~;
+#X floatatom 140 220 5 0 0 0 - - -;
+#X msg 68 58 seed 30000;
+#X obj 142 131 random_fl~;
+#X text 120 98 etc ..;
+#X obj 229 131 random_icg~;
+#X obj 81 241 fader 75;
+#X connect 0 0 13 0;
+#X connect 3 0 5 0;
+#X connect 4 0 5 1;
+#X connect 5 0 1 0;
+#X connect 6 0 1 0;
+#X connect 8 0 13 2;
+#X connect 9 0 0 0;
+#X connect 10 0 13 1;
+#X connect 12 0 1 0;
+#X connect 12 0 13 0;
+#X connect 13 0 7 0;
+#X connect 13 1 7 1;
+#X restore 98 421 pd signalversions;
+#X connect 0 0 11 0;
+#X connect 1 0 11 1;
+#X connect 4 0 6 0;
+#X connect 5 0 11 2;
+#X connect 6 0 3 0;
+#X connect 7 0 12 0;
+#X connect 8 0 12 1;
+#X connect 10 0 12 2;
+#X connect 11 0 2 0;
+#X connect 12 0 9 0;
+#X connect 13 0 17 0;
+#X connect 14 0 17 1;
+#X connect 16 0 17 2;
+#X connect 17 0 15 0;
+#X connect 18 0 29 0;
+#X connect 19 0 29 1;
+#X connect 21 0 29 2;
+#X connect 23 0 29 0;
+#X connect 25 0 31 0;
+#X connect 25 0 32 0;
+#X connect 25 0 34 0;
+#X connect 26 0 33 0;
+#X connect 27 0 33 0;
+#X connect 28 0 27 0;
+#X connect 29 0 20 0;
+#X connect 30 0 27 1;
+#X connect 33 0 25 0;
+#X connect 35 0 6 0;
+#X connect 35 1 11 0;
+#X connect 35 2 12 0;
+#X connect 35 3 17 0;
+#X connect 35 4 29 0;
diff --git a/random_fl~.c b/random_fl~.c
new file mode 100644
index 0000000..83b4347
--- /dev/null
+++ b/random_fl~.c
@@ -0,0 +1,100 @@
+/*
+ (c) 2002:cxc@web.fm
+ randomix: various PRNG's
+ code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html
+ let's check it out
+ */
+
+#include <m_pd.h>
+#include <stdlib.h>
+#include <math.h>
+
+#define SMALLEST_RANGE .0001
+
+#ifndef RAND_MAX
+#define RAND_MAX 2147483647
+#endif
+
+static int makeseed(void);
+static int rand_random_fl(int);
+
+static int makeseed(void)
+{
+ static unsigned int random1_nextseed = 1489853723;
+ random1_nextseed = random1_nextseed * 435898247 + 938284287;
+ return (random1_nextseed & 0x7fffffff);
+}
+
+static int rand_random_fl(seed) {
+ int q;
+ double state;
+
+ /* The following parameters are recommended settings based on research
+ uncomment the one you want. */
+
+ double a = 1389796, m = RAND_MAX;
+ /* static double a = 950975, m = 2147483647; */
+ /* static double a = 3467255, m = 21474836472; */
+ /* static double a = 657618, m = 4294967291; */
+ /* static double a = 93167, m = 4294967291; */
+ /* static double a = 1345659, m = 4294967291; */
+
+ state = seed;
+ state *= a;
+ q = state / m;
+ state -= q*m;
+ return state;
+}
+
+/* ------------------------------- random_fl signal version -------------------- */
+
+static t_class *random_fl_tilde_class;
+
+typedef struct _random_fl_tilde
+{
+ t_object x_obj;
+ unsigned int x_state; // current seed
+} t_random_fl_tilde;
+
+static void *random_fl_tilde_new()
+{
+ t_random_fl_tilde *x = (t_random_fl_tilde *)pd_new(random_fl_tilde_class);
+ x->x_state = makeseed();
+ outlet_new(&x->x_obj, gensym("signal"));
+ return (x);
+}
+
+static void random_fl_tilde_seed(t_random_fl_tilde *x, float f, float glob)
+{
+ x->x_state = f;
+}
+
+static t_int *random_fl_tilde_perform(t_int *w)
+{
+ t_random_fl_tilde *x = (t_random_fl_tilde *)(w[1]);
+ t_float *out = (t_float *)(w[2]);
+ int n = (int)(w[3]);
+
+ while (n--) {
+ // generate new noise sample
+ x->x_state = rand_random_fl(x->x_state);
+ *out++ = (t_float)x->x_state / RAND_MAX * 2 - 1;
+ }
+
+ return (w+4);
+}
+
+static void random_fl_tilde_dsp(t_random_fl_tilde *x, t_signal **sp)
+{
+ dsp_add(random_fl_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
+}
+
+void random_fl_tilde_setup(void)
+{
+ random_fl_tilde_class = class_new(gensym("random_fl~"),
+ (t_newmethod)random_fl_tilde_new, 0,
+ sizeof(t_random_fl_tilde), 0, 0);
+ class_addmethod(random_fl_tilde_class, (t_method)random_fl_tilde_seed,
+ gensym("seed"), A_FLOAT, 0);
+ class_addmethod(random_fl_tilde_class, (t_method)random_fl_tilde_dsp, gensym("dsp"), 0);
+}
diff --git a/random_icg-help.pd b/random_icg-help.pd
new file mode 100644
index 0000000..d913f39
--- /dev/null
+++ b/random_icg-help.pd
@@ -0,0 +1,223 @@
+#N canvas 33 162 966 505 10;
+#X msg 197 150 bang;
+#X floatatom 244 150 5 0 0 0 - - -;
+#X floatatom 197 218 10 0 0 0 - - -;
+#X floatatom 53 162 5 0 0 0 - - -;
+#X msg 54 111 bang;
+#X floatatom 289 152 5 0 0 0 - - -;
+#X obj 53 135 random 100;
+#X msg 427 151 bang;
+#X floatatom 474 151 5 0 0 0 - - -;
+#X floatatom 427 219 10 0 0 0 - - -;
+#X floatatom 519 153 5 0 0 0 - - -;
+#X obj 196 183 random1 0 1;
+#X obj 426 184 random_fl 0 1;
+#X msg 672 152 bang;
+#X floatatom 719 152 5 0 0 0 - - -;
+#X floatatom 672 220 10 0 0 0 - - -;
+#X floatatom 764 154 5 0 0 0 - - -;
+#X obj 671 185 random_icg 0 1;
+#X msg 197 276 bang;
+#X floatatom 244 276 5 0 0 0 - - -;
+#X floatatom 197 344 10 0 0 0 - - -;
+#X floatatom 289 278 5 0 0 0 - - -;
+#X text 193 251 random_icg lowerlimit \, upperlimit;
+#X msg 368 288 help;
+#X text 253 10 the random number generatorse;
+#X obj 539 406 dist_normal;
+#X msg 540 356 bang;
+#X obj 579 357 metro 100;
+#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0
+1;
+#X obj 196 309 random_tw 0 1;
+#X floatatom 637 334 5 0 0 0 - - -;
+#N canvas 0 0 600 400 streamview 0;
+#N canvas 0 0 450 300 graph2 0;
+#X array randstream 100 float 0;
+#X coords 0 2 99 -2 200 140 1;
+#X restore 92 222 graph;
+#X obj 146 144 tabwrite randstream;
+#X obj 200 63 count;
+#X obj 200 88 % 100;
+#X obj 156 28 t f b;
+#X obj 49 15 inlet;
+#X connect 2 0 3 0;
+#X connect 3 0 1 1;
+#X connect 4 0 1 0;
+#X connect 4 1 2 0;
+#X connect 5 0 4 0;
+#X restore 570 433 pd streamview;
+#N canvas 306 24 679 400 distview 0;
+#N canvas 0 0 450 300 graph1 0;
+#X array randview1 100 float 0;
+#X coords 0 200 99 0 400 200 1;
+#X restore 248 31 graph;
+#X obj 28 26 inlet;
+#X obj 45 355 tabwrite randview1;
+#X obj 136 201 * 100;
+#X obj 136 225 int;
+#X obj 136 153 + 2;
+#X obj 45 280 tabread randview1;
+#X obj 136 176 / 4;
+#X obj 136 250 t f f;
+#X obj 45 304 t f b;
+#X obj 45 329 + 1;
+#X obj 136 129 t f;
+#X connect 1 0 11 0;
+#X connect 3 0 4 0;
+#X connect 4 0 8 0;
+#X connect 5 0 7 0;
+#X connect 6 0 9 0;
+#X connect 7 0 3 0;
+#X connect 8 0 6 0;
+#X connect 8 1 2 1;
+#X connect 9 0 10 0;
+#X connect 10 0 2 0;
+#X connect 11 0 5 0;
+#X restore 550 458 pd distview;
+#X obj 540 381 t b;
+#X floatatom 477 430 5 0 0 0 - - -;
+#N canvas 0 0 600 400 seedit 0;
+#X msg 284 154 seed \$1;
+#X obj 284 107 utime;
+#X msg 304 74 bang;
+#X obj 254 28 loadbang;
+#X obj 284 130 * 1e+06;
+#X obj 360 167 until;
+#X msg 455 156 bang;
+#X obj 359 194 random 2.14748e+08;
+#X msg 359 267 seed \$1;
+#X msg 385 294 seed \$1;
+#X msg 412 318 seed \$1;
+#X msg 439 267 seed \$1;
+#X msg 466 293 seed \$1;
+#X obj 254 50 t b b;
+#X obj 195 155 print seed1;
+#X obj 143 360 outlet;
+#X obj 204 361 outlet;
+#X obj 264 361 outlet;
+#X obj 317 361 outlet;
+#X obj 367 361 outlet;
+#X text 35 9 seed one random obj \, which generates the seeds for all
+the others.;
+#X obj 359 218 serialize 6;
+#X msg 360 140 6;
+#X obj 359 242 unpack f f f f f f;
+#X msg 485 317 seed \$1;
+#X obj 420 359 outlet;
+#X connect 0 0 7 0;
+#X connect 1 1 4 0;
+#X connect 2 0 1 0;
+#X connect 3 0 13 0;
+#X connect 4 0 0 0;
+#X connect 4 0 14 0;
+#X connect 5 0 7 0;
+#X connect 6 0 7 0;
+#X connect 7 0 21 0;
+#X connect 8 0 15 0;
+#X connect 9 0 16 0;
+#X connect 10 0 17 0;
+#X connect 11 0 18 0;
+#X connect 12 0 19 0;
+#X connect 13 0 22 0;
+#X connect 13 1 1 0;
+#X connect 21 0 23 0;
+#X connect 22 0 5 0;
+#X connect 23 0 8 0;
+#X connect 23 1 9 0;
+#X connect 23 2 10 0;
+#X connect 23 3 11 0;
+#X connect 23 4 12 0;
+#X connect 23 5 24 0;
+#X connect 24 0 25 0;
+#X restore 258 33 pd seedit;
+#X text 37 79 std pd random;
+#X text 197 124 linear congruential generator;
+#X text 197 77 creation arguments for the extra randoms are:;
+#X text 205 92 <range-min \, range-max> \, defaults to 0 respectively
+RAND_MAX;
+#X text 545 17 see also:;
+#X obj 545 40 utime;
+#X text 428 129 another lcg method ..;
+#X text 668 127 inverse linear congruential generator;
+#X text 536 249 normal distribution mean 0 and dist 1;
+#X text 536 264 right now it uses random1 for the actual rand values
+;
+#X text 537 278 but later on it should take one of the randoms as creation
+argument \, so yu can specify which generator is being used.;
+#X text 198 106 they all output floats);
+#X text 540 311 also \, there is some burst at the upper and lower
+limits;
+#N canvas 622 685 592 356 signalversions 1;
+#X obj 68 131 random1~;
+#X obj 368 239 tabwrite~ randomix_test;
+#N canvas 0 0 450 300 graph1 0;
+#X array randomix_test 64 float 1;
+#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236
+0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908
+0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915
+-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131
+-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501
+-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181
+-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187
+-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429
+0.0862183 -0.995607 0.585034 0.205198 -0.337256;
+#X coords 0 1 63 -1 200 140 1;
+#X restore 351 23 graph;
+#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X floatatom 440 184 5 0 0 0 - - -;
+#X obj 382 201 metro 100;
+#X msg 342 201 bang;
+#X obj 73 295 dac~;
+#X floatatom 140 220 5 0 0 0 - - -;
+#X msg 68 58 seed 30000;
+#X obj 142 131 random_fl~;
+#X text 120 98 etc ..;
+#X obj 229 131 random_icg~;
+#X obj 81 241 fader 75;
+#X connect 0 0 13 0;
+#X connect 3 0 5 0;
+#X connect 4 0 5 1;
+#X connect 5 0 1 0;
+#X connect 6 0 1 0;
+#X connect 8 0 13 2;
+#X connect 9 0 0 0;
+#X connect 10 0 13 1;
+#X connect 12 0 1 0;
+#X connect 12 0 13 0;
+#X connect 13 0 7 0;
+#X connect 13 1 7 1;
+#X restore 98 421 pd signalversions;
+#X connect 0 0 11 0;
+#X connect 1 0 11 1;
+#X connect 4 0 6 0;
+#X connect 5 0 11 2;
+#X connect 6 0 3 0;
+#X connect 7 0 12 0;
+#X connect 8 0 12 1;
+#X connect 10 0 12 2;
+#X connect 11 0 2 0;
+#X connect 12 0 9 0;
+#X connect 13 0 17 0;
+#X connect 14 0 17 1;
+#X connect 16 0 17 2;
+#X connect 17 0 15 0;
+#X connect 18 0 29 0;
+#X connect 19 0 29 1;
+#X connect 21 0 29 2;
+#X connect 23 0 29 0;
+#X connect 25 0 31 0;
+#X connect 25 0 32 0;
+#X connect 25 0 34 0;
+#X connect 26 0 33 0;
+#X connect 27 0 33 0;
+#X connect 28 0 27 0;
+#X connect 29 0 20 0;
+#X connect 30 0 27 1;
+#X connect 33 0 25 0;
+#X connect 35 0 6 0;
+#X connect 35 1 11 0;
+#X connect 35 2 12 0;
+#X connect 35 3 17 0;
+#X connect 35 4 29 0;
diff --git a/random_icg.c b/random_icg.c
new file mode 100644
index 0000000..a1d76f1
--- /dev/null
+++ b/random_icg.c
@@ -0,0 +1,173 @@
+/*
+ (c) 2002:cxc@web.fm
+ randomix: various PRNG's
+ code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html
+ let's check it out
+ */
+
+#include <m_pd.h>
+#include <stdlib.h>
+#include <math.h>
+
+#define SMALLEST_RANGE .0001
+
+#ifndef RAND_MAX
+#define RAND_MAX 2147483647
+#endif
+
+static unsigned random_icg_INVERSE_seed ();
+static int makeseed(void);
+static int rand_random_icg(int, int);
+static unsigned int rand_random_icg_INVERSE_seed(int, int);
+
+static int makeseed(void)
+{
+ static unsigned int random1_nextseed = 1489853723;
+ random1_nextseed = random1_nextseed * 435898247 + 938284287;
+ return (random1_nextseed & 0x7fffffff);
+}
+
+static int rand_random_icg(seed, p)
+{
+ static int a, b, q, r;
+ int state;
+ unsigned int inv;
+ a = 22211, b = 11926380,q = 96685, r = 12518;
+ /* static int p = 2147483053, a = 858993221, b = 1,q = 2, r = 429496611;*/
+ /* static int p = 2147483053, a = 579, b = 24456079, q = 3708951, r = 424;*/
+ /* static int p = 2147483053, a = 11972, b = 62187060,q = 179375, r = 5553;*/
+ /* static int p = 2147483053, a = 21714, b = 94901263,q = 98898, r = 11881;*/
+ /* static int p = 2147483053, a = 4594, b = 44183289,q = 467453, r = 3971;*/
+ /* static int p = 2147483647, a = 1288490188, b = 1, q = 1, r = 858993459;*/
+ /* static int p = 2147483647, a = 9102, b = 36884165, q = 235935, r =3277;*/
+ /* static int p = 2147483647, a = 14288, b = 758634, q = 150299, r = 11535;*/
+ /* static int p = 2147483647, a = 21916, b = 71499791, q = 97987, r = 555;*/
+ /* static int p = 2147483647, a = 28933, b = 59217914, q = 74222, r = 18521;*/
+ /* static int p = 2147483647, a = 31152, b = 48897674, q = 68935, r = 20527;*/
+
+ // state = seed;
+
+ inv = rand_random_icg_INVERSE_seed(seed, p);
+
+ state = a*(inv % q) - r*(inv / q) + b;
+
+ if (state < 0) state += p;
+ else if (state >= state) state -= p;
+
+ return state;
+}
+
+/* Modular Inversion using the extended Euclidean alg. for GCD */
+/***************************************************************/
+static unsigned rand_random_icg_INVERSE_seed (int state, int p)
+{
+ unsigned int q,d;
+ signed int u,v,inv,t;
+
+ if (state <= 1) return(state);
+
+ d = p; inv = 0; v = 1; u = state;
+
+ do {
+ q = d / u;
+ t = d % u;
+ d = u;
+ u = t;
+ t = inv - q*v;
+ inv = v;
+ v = t;
+ } while (u != 0);
+
+ if (inv < 0 ) inv += p;
+
+/* if (1 != d) */
+/* post ("inverse_iter: Can't invert !"); */
+
+ return(inv);
+}
+
+/* -------------------------- random_icg ------------------------------ */
+/* Inverse Congruential generator. This generator is quite a bit slower than the other ones on this page. and it */
+/* fails some statistical tests. The main factor in its favor is that its properties tend to be the opposite of linear congruential */
+/* generators. I.e. this generator is very likely to be good for those applications where linear congruential generators are */
+/* bad. You can choose among several parameters. */
+
+/* inversive congruential generator. */
+
+static t_class *random_icg_class;
+
+typedef struct _random_icg
+{
+ t_object x_obj;
+ t_float x_f; // lower limit
+ t_float x_g; // upper limit
+ t_float x_p; // 1st shared parameter of iter function ..
+ unsigned int x_state; // current seed
+} t_random_icg;
+
+static void *random_icg_new(t_floatarg f, t_floatarg g)
+{
+ t_random_icg *x = (t_random_icg *)pd_new(random_icg_class);
+ x->x_f = (f) ? f : 0;
+ x->x_g = (g) ? g : RAND_MAX;
+ x->x_p = 2147483053;
+ //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g);
+ x->x_state = makeseed();
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2"));
+ outlet_new(&x->x_obj, &s_float);
+ return (x);
+}
+
+static void random_icg_bang(t_random_icg *x)
+{
+ double nval;
+
+ x->x_state = rand_random_icg(x->x_state, x->x_p);
+
+ nval = (((x->x_state / x->x_p) - 1) * (double)(x->x_g - x->x_f) + (double)x->x_f);
+
+ // hakc, why is it out of range?
+ if(nval < (double)x->x_f) {
+ random_icg_bang(x);
+ } else {
+ outlet_float(x->x_obj.ob_outlet, nval);
+ }
+}
+
+void random_icg_low(t_random_icg *x, t_floatarg f)
+{
+ if(f >= x->x_g) {
+ post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f",
+ SMALLEST_RANGE,
+ x->x_g - SMALLEST_RANGE);
+ x->x_f = x->x_g - SMALLEST_RANGE;
+ } else x->x_f = f;
+}
+
+void random_icg_upp(t_random_icg *x, t_floatarg f)
+{
+ if(f <= x->x_f) {
+ post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f",
+ SMALLEST_RANGE,
+ x->x_f + SMALLEST_RANGE);
+ x->x_g = x->x_f + SMALLEST_RANGE;
+ } else x->x_g = f;
+}
+
+static void random_icg_seed(t_random_icg *x, float f, float glob)
+{
+ x->x_state = f;
+}
+
+void random_icg_setup(void)
+{
+ random_icg_class = class_new(gensym("random_icg"), (t_newmethod)random_icg_new, 0,
+ sizeof(t_random_icg), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addbang(random_icg_class, random_icg_bang);
+ class_addmethod(random_icg_class, (t_method)random_icg_low, gensym("fl1"), A_FLOAT, 0);
+ class_addmethod(random_icg_class, (t_method)random_icg_upp, gensym("fl2"), A_FLOAT, 0);
+
+ class_addmethod(random_icg_class, (t_method)random_icg_seed,
+ gensym("seed"), A_FLOAT, 0);
+}
diff --git a/random_icg~-help.pd b/random_icg~-help.pd
new file mode 100644
index 0000000..d913f39
--- /dev/null
+++ b/random_icg~-help.pd
@@ -0,0 +1,223 @@
+#N canvas 33 162 966 505 10;
+#X msg 197 150 bang;
+#X floatatom 244 150 5 0 0 0 - - -;
+#X floatatom 197 218 10 0 0 0 - - -;
+#X floatatom 53 162 5 0 0 0 - - -;
+#X msg 54 111 bang;
+#X floatatom 289 152 5 0 0 0 - - -;
+#X obj 53 135 random 100;
+#X msg 427 151 bang;
+#X floatatom 474 151 5 0 0 0 - - -;
+#X floatatom 427 219 10 0 0 0 - - -;
+#X floatatom 519 153 5 0 0 0 - - -;
+#X obj 196 183 random1 0 1;
+#X obj 426 184 random_fl 0 1;
+#X msg 672 152 bang;
+#X floatatom 719 152 5 0 0 0 - - -;
+#X floatatom 672 220 10 0 0 0 - - -;
+#X floatatom 764 154 5 0 0 0 - - -;
+#X obj 671 185 random_icg 0 1;
+#X msg 197 276 bang;
+#X floatatom 244 276 5 0 0 0 - - -;
+#X floatatom 197 344 10 0 0 0 - - -;
+#X floatatom 289 278 5 0 0 0 - - -;
+#X text 193 251 random_icg lowerlimit \, upperlimit;
+#X msg 368 288 help;
+#X text 253 10 the random number generatorse;
+#X obj 539 406 dist_normal;
+#X msg 540 356 bang;
+#X obj 579 357 metro 100;
+#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0
+1;
+#X obj 196 309 random_tw 0 1;
+#X floatatom 637 334 5 0 0 0 - - -;
+#N canvas 0 0 600 400 streamview 0;
+#N canvas 0 0 450 300 graph2 0;
+#X array randstream 100 float 0;
+#X coords 0 2 99 -2 200 140 1;
+#X restore 92 222 graph;
+#X obj 146 144 tabwrite randstream;
+#X obj 200 63 count;
+#X obj 200 88 % 100;
+#X obj 156 28 t f b;
+#X obj 49 15 inlet;
+#X connect 2 0 3 0;
+#X connect 3 0 1 1;
+#X connect 4 0 1 0;
+#X connect 4 1 2 0;
+#X connect 5 0 4 0;
+#X restore 570 433 pd streamview;
+#N canvas 306 24 679 400 distview 0;
+#N canvas 0 0 450 300 graph1 0;
+#X array randview1 100 float 0;
+#X coords 0 200 99 0 400 200 1;
+#X restore 248 31 graph;
+#X obj 28 26 inlet;
+#X obj 45 355 tabwrite randview1;
+#X obj 136 201 * 100;
+#X obj 136 225 int;
+#X obj 136 153 + 2;
+#X obj 45 280 tabread randview1;
+#X obj 136 176 / 4;
+#X obj 136 250 t f f;
+#X obj 45 304 t f b;
+#X obj 45 329 + 1;
+#X obj 136 129 t f;
+#X connect 1 0 11 0;
+#X connect 3 0 4 0;
+#X connect 4 0 8 0;
+#X connect 5 0 7 0;
+#X connect 6 0 9 0;
+#X connect 7 0 3 0;
+#X connect 8 0 6 0;
+#X connect 8 1 2 1;
+#X connect 9 0 10 0;
+#X connect 10 0 2 0;
+#X connect 11 0 5 0;
+#X restore 550 458 pd distview;
+#X obj 540 381 t b;
+#X floatatom 477 430 5 0 0 0 - - -;
+#N canvas 0 0 600 400 seedit 0;
+#X msg 284 154 seed \$1;
+#X obj 284 107 utime;
+#X msg 304 74 bang;
+#X obj 254 28 loadbang;
+#X obj 284 130 * 1e+06;
+#X obj 360 167 until;
+#X msg 455 156 bang;
+#X obj 359 194 random 2.14748e+08;
+#X msg 359 267 seed \$1;
+#X msg 385 294 seed \$1;
+#X msg 412 318 seed \$1;
+#X msg 439 267 seed \$1;
+#X msg 466 293 seed \$1;
+#X obj 254 50 t b b;
+#X obj 195 155 print seed1;
+#X obj 143 360 outlet;
+#X obj 204 361 outlet;
+#X obj 264 361 outlet;
+#X obj 317 361 outlet;
+#X obj 367 361 outlet;
+#X text 35 9 seed one random obj \, which generates the seeds for all
+the others.;
+#X obj 359 218 serialize 6;
+#X msg 360 140 6;
+#X obj 359 242 unpack f f f f f f;
+#X msg 485 317 seed \$1;
+#X obj 420 359 outlet;
+#X connect 0 0 7 0;
+#X connect 1 1 4 0;
+#X connect 2 0 1 0;
+#X connect 3 0 13 0;
+#X connect 4 0 0 0;
+#X connect 4 0 14 0;
+#X connect 5 0 7 0;
+#X connect 6 0 7 0;
+#X connect 7 0 21 0;
+#X connect 8 0 15 0;
+#X connect 9 0 16 0;
+#X connect 10 0 17 0;
+#X connect 11 0 18 0;
+#X connect 12 0 19 0;
+#X connect 13 0 22 0;
+#X connect 13 1 1 0;
+#X connect 21 0 23 0;
+#X connect 22 0 5 0;
+#X connect 23 0 8 0;
+#X connect 23 1 9 0;
+#X connect 23 2 10 0;
+#X connect 23 3 11 0;
+#X connect 23 4 12 0;
+#X connect 23 5 24 0;
+#X connect 24 0 25 0;
+#X restore 258 33 pd seedit;
+#X text 37 79 std pd random;
+#X text 197 124 linear congruential generator;
+#X text 197 77 creation arguments for the extra randoms are:;
+#X text 205 92 <range-min \, range-max> \, defaults to 0 respectively
+RAND_MAX;
+#X text 545 17 see also:;
+#X obj 545 40 utime;
+#X text 428 129 another lcg method ..;
+#X text 668 127 inverse linear congruential generator;
+#X text 536 249 normal distribution mean 0 and dist 1;
+#X text 536 264 right now it uses random1 for the actual rand values
+;
+#X text 537 278 but later on it should take one of the randoms as creation
+argument \, so yu can specify which generator is being used.;
+#X text 198 106 they all output floats);
+#X text 540 311 also \, there is some burst at the upper and lower
+limits;
+#N canvas 622 685 592 356 signalversions 1;
+#X obj 68 131 random1~;
+#X obj 368 239 tabwrite~ randomix_test;
+#N canvas 0 0 450 300 graph1 0;
+#X array randomix_test 64 float 1;
+#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236
+0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908
+0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915
+-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131
+-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501
+-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181
+-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187
+-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429
+0.0862183 -0.995607 0.585034 0.205198 -0.337256;
+#X coords 0 1 63 -1 200 140 1;
+#X restore 351 23 graph;
+#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X floatatom 440 184 5 0 0 0 - - -;
+#X obj 382 201 metro 100;
+#X msg 342 201 bang;
+#X obj 73 295 dac~;
+#X floatatom 140 220 5 0 0 0 - - -;
+#X msg 68 58 seed 30000;
+#X obj 142 131 random_fl~;
+#X text 120 98 etc ..;
+#X obj 229 131 random_icg~;
+#X obj 81 241 fader 75;
+#X connect 0 0 13 0;
+#X connect 3 0 5 0;
+#X connect 4 0 5 1;
+#X connect 5 0 1 0;
+#X connect 6 0 1 0;
+#X connect 8 0 13 2;
+#X connect 9 0 0 0;
+#X connect 10 0 13 1;
+#X connect 12 0 1 0;
+#X connect 12 0 13 0;
+#X connect 13 0 7 0;
+#X connect 13 1 7 1;
+#X restore 98 421 pd signalversions;
+#X connect 0 0 11 0;
+#X connect 1 0 11 1;
+#X connect 4 0 6 0;
+#X connect 5 0 11 2;
+#X connect 6 0 3 0;
+#X connect 7 0 12 0;
+#X connect 8 0 12 1;
+#X connect 10 0 12 2;
+#X connect 11 0 2 0;
+#X connect 12 0 9 0;
+#X connect 13 0 17 0;
+#X connect 14 0 17 1;
+#X connect 16 0 17 2;
+#X connect 17 0 15 0;
+#X connect 18 0 29 0;
+#X connect 19 0 29 1;
+#X connect 21 0 29 2;
+#X connect 23 0 29 0;
+#X connect 25 0 31 0;
+#X connect 25 0 32 0;
+#X connect 25 0 34 0;
+#X connect 26 0 33 0;
+#X connect 27 0 33 0;
+#X connect 28 0 27 0;
+#X connect 29 0 20 0;
+#X connect 30 0 27 1;
+#X connect 33 0 25 0;
+#X connect 35 0 6 0;
+#X connect 35 1 11 0;
+#X connect 35 2 12 0;
+#X connect 35 3 17 0;
+#X connect 35 4 29 0;
diff --git a/random_icg~.c b/random_icg~.c
new file mode 100644
index 0000000..178814b
--- /dev/null
+++ b/random_icg~.c
@@ -0,0 +1,164 @@
+/*
+ (c) 2002:cxc@web.fm
+ randomix: various PRNG's
+ code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html
+ let's check it out
+ */
+
+#include <m_pd.h>
+#include <stdlib.h>
+#include <math.h>
+
+#define SMALLEST_RANGE .0001
+
+#ifndef RAND_MAX
+#define RAND_MAX 2147483647
+#endif
+
+static int makeseed(void);
+static int rand_random_icg(int, int);
+static unsigned int rand_random_icg_INVERSE_seed(int, int);
+
+static int makeseed(void)
+{
+ static unsigned int random1_nextseed = 1489853723;
+ random1_nextseed = random1_nextseed * 435898247 + 938284287;
+ return (random1_nextseed & 0x7fffffff);
+}
+
+static int rand_random_icg(seed, p)
+{
+ static int a, b, q, r;
+ int state;
+ unsigned int inv;
+ a = 22211, b = 11926380,q = 96685, r = 12518;
+ /* static int p = 2147483053, a = 858993221, b = 1,q = 2, r = 429496611;*/
+ /* static int p = 2147483053, a = 579, b = 24456079, q = 3708951, r = 424;*/
+ /* static int p = 2147483053, a = 11972, b = 62187060,q = 179375, r = 5553;*/
+ /* static int p = 2147483053, a = 21714, b = 94901263,q = 98898, r = 11881;*/
+ /* static int p = 2147483053, a = 4594, b = 44183289,q = 467453, r = 3971;*/
+ /* static int p = 2147483647, a = 1288490188, b = 1, q = 1, r = 858993459;*/
+ /* static int p = 2147483647, a = 9102, b = 36884165, q = 235935, r =3277;*/
+ /* static int p = 2147483647, a = 14288, b = 758634, q = 150299, r = 11535;*/
+ /* static int p = 2147483647, a = 21916, b = 71499791, q = 97987, r = 555;*/
+ /* static int p = 2147483647, a = 28933, b = 59217914, q = 74222, r = 18521;*/
+ /* static int p = 2147483647, a = 31152, b = 48897674, q = 68935, r = 20527;*/
+
+ // state = seed;
+
+ inv = rand_random_icg_INVERSE_seed(seed, p);
+
+ state = a*(inv % q) - r*(inv / q) + b;
+
+ if (state < 0) state += p;
+ else if (state >= state) state -= p;
+
+ return state;
+}
+
+/* Modular Inversion using the extended Euclidean alg. for GCD */
+/***************************************************************/
+static unsigned rand_random_icg_INVERSE_seed (int state, int p)
+{
+ unsigned int q,d;
+ signed int u,v,inv,t;
+
+ if (state <= 1) return(state);
+
+ d = p; inv = 0; v = 1; u = state;
+
+ do {
+ q = d / u;
+ t = d % u;
+ d = u;
+ u = t;
+ t = inv - q*v;
+ inv = v;
+ v = t;
+ } while (u != 0);
+
+ if (inv < 0 ) inv += p;
+
+/* if (1 != d) */
+/* post ("inverse_iter: Can't invert !"); */
+
+ return(inv);
+}
+
+/* -------------------------- random_icg ------------------------------ */
+/* inverse congruential generator. */
+
+static t_class *random_icg_tilde_class;
+
+typedef struct _random_icg_tilde
+{
+ t_object x_obj;
+ t_float x_f; // lower limit
+ t_float x_g; // upper limit
+ t_float x_p; // 1st shared parameter of iter function ..
+ unsigned int x_state; // current seed
+} t_random_icg_tilde;
+
+static void *random_icg_tilde_new()
+{
+ t_random_icg_tilde *x = (t_random_icg_tilde *)pd_new(random_icg_tilde_class);
+/* x->x_f = (f) ? f : 0; */
+/* x->x_g = (g) ? g : RAND_MAX; */
+ x->x_p = 2147483053;
+ //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g);
+ x->x_state = makeseed();
+ outlet_new(&x->x_obj, gensym("signal"));
+ return (x);
+}
+
+static void random_icg_tilde_bang(t_random_icg_tilde *x)
+{
+ double nval;
+
+ x->x_state = rand_random_icg(x->x_state, x->x_p);
+
+ nval = (((x->x_state / x->x_p) - 1) * (double)(x->x_g - x->x_f) + (double)x->x_f);
+
+ // hakc, why is it out of range?
+ if(nval < (double)x->x_f) {
+ random_icg_tilde_bang(x);
+ } else {
+ outlet_float(x->x_obj.ob_outlet, nval);
+ }
+}
+
+static void random_icg_tilde_seed(t_random_icg_tilde *x, float f, float glob)
+{
+ x->x_state = f;
+}
+
+static t_int *random_icg_tilde_perform(t_int *w)
+{
+ t_random_icg_tilde *x = (t_random_icg_tilde *)(w[1]);
+ t_float *out = (t_float *)(w[2]);
+ int n = (int)(w[3]);
+
+ while (n--) {
+ // generate new noise sample
+ x->x_state = rand_random_icg(x->x_state, x->x_p);
+ *out++ = (t_float)(x->x_state / x->x_p - 1) * 2 - 1;
+ }
+
+ return (w+4);
+}
+
+
+static void random_icg_tilde_dsp(t_random_icg_tilde *x, t_signal **sp)
+{
+ dsp_add(random_icg_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
+}
+
+
+void random_icg_tilde_setup(void)
+{
+ random_icg_tilde_class = class_new(gensym("random_icg~"), (t_newmethod)random_icg_tilde_new, 0,
+ sizeof(t_random_icg_tilde), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addmethod(random_icg_tilde_class, (t_method)random_icg_tilde_seed,
+ gensym("seed"), A_FLOAT, 0);
+ class_addmethod(random_icg_tilde_class, (t_method)random_icg_tilde_dsp, gensym("dsp"), 0);
+}
diff --git a/random_tw-help.pd b/random_tw-help.pd
new file mode 100644
index 0000000..d913f39
--- /dev/null
+++ b/random_tw-help.pd
@@ -0,0 +1,223 @@
+#N canvas 33 162 966 505 10;
+#X msg 197 150 bang;
+#X floatatom 244 150 5 0 0 0 - - -;
+#X floatatom 197 218 10 0 0 0 - - -;
+#X floatatom 53 162 5 0 0 0 - - -;
+#X msg 54 111 bang;
+#X floatatom 289 152 5 0 0 0 - - -;
+#X obj 53 135 random 100;
+#X msg 427 151 bang;
+#X floatatom 474 151 5 0 0 0 - - -;
+#X floatatom 427 219 10 0 0 0 - - -;
+#X floatatom 519 153 5 0 0 0 - - -;
+#X obj 196 183 random1 0 1;
+#X obj 426 184 random_fl 0 1;
+#X msg 672 152 bang;
+#X floatatom 719 152 5 0 0 0 - - -;
+#X floatatom 672 220 10 0 0 0 - - -;
+#X floatatom 764 154 5 0 0 0 - - -;
+#X obj 671 185 random_icg 0 1;
+#X msg 197 276 bang;
+#X floatatom 244 276 5 0 0 0 - - -;
+#X floatatom 197 344 10 0 0 0 - - -;
+#X floatatom 289 278 5 0 0 0 - - -;
+#X text 193 251 random_icg lowerlimit \, upperlimit;
+#X msg 368 288 help;
+#X text 253 10 the random number generatorse;
+#X obj 539 406 dist_normal;
+#X msg 540 356 bang;
+#X obj 579 357 metro 100;
+#X obj 579 337 tgl 15 0 empty empty empty 20 8 0 8 -262144 -1 -1 0
+1;
+#X obj 196 309 random_tw 0 1;
+#X floatatom 637 334 5 0 0 0 - - -;
+#N canvas 0 0 600 400 streamview 0;
+#N canvas 0 0 450 300 graph2 0;
+#X array randstream 100 float 0;
+#X coords 0 2 99 -2 200 140 1;
+#X restore 92 222 graph;
+#X obj 146 144 tabwrite randstream;
+#X obj 200 63 count;
+#X obj 200 88 % 100;
+#X obj 156 28 t f b;
+#X obj 49 15 inlet;
+#X connect 2 0 3 0;
+#X connect 3 0 1 1;
+#X connect 4 0 1 0;
+#X connect 4 1 2 0;
+#X connect 5 0 4 0;
+#X restore 570 433 pd streamview;
+#N canvas 306 24 679 400 distview 0;
+#N canvas 0 0 450 300 graph1 0;
+#X array randview1 100 float 0;
+#X coords 0 200 99 0 400 200 1;
+#X restore 248 31 graph;
+#X obj 28 26 inlet;
+#X obj 45 355 tabwrite randview1;
+#X obj 136 201 * 100;
+#X obj 136 225 int;
+#X obj 136 153 + 2;
+#X obj 45 280 tabread randview1;
+#X obj 136 176 / 4;
+#X obj 136 250 t f f;
+#X obj 45 304 t f b;
+#X obj 45 329 + 1;
+#X obj 136 129 t f;
+#X connect 1 0 11 0;
+#X connect 3 0 4 0;
+#X connect 4 0 8 0;
+#X connect 5 0 7 0;
+#X connect 6 0 9 0;
+#X connect 7 0 3 0;
+#X connect 8 0 6 0;
+#X connect 8 1 2 1;
+#X connect 9 0 10 0;
+#X connect 10 0 2 0;
+#X connect 11 0 5 0;
+#X restore 550 458 pd distview;
+#X obj 540 381 t b;
+#X floatatom 477 430 5 0 0 0 - - -;
+#N canvas 0 0 600 400 seedit 0;
+#X msg 284 154 seed \$1;
+#X obj 284 107 utime;
+#X msg 304 74 bang;
+#X obj 254 28 loadbang;
+#X obj 284 130 * 1e+06;
+#X obj 360 167 until;
+#X msg 455 156 bang;
+#X obj 359 194 random 2.14748e+08;
+#X msg 359 267 seed \$1;
+#X msg 385 294 seed \$1;
+#X msg 412 318 seed \$1;
+#X msg 439 267 seed \$1;
+#X msg 466 293 seed \$1;
+#X obj 254 50 t b b;
+#X obj 195 155 print seed1;
+#X obj 143 360 outlet;
+#X obj 204 361 outlet;
+#X obj 264 361 outlet;
+#X obj 317 361 outlet;
+#X obj 367 361 outlet;
+#X text 35 9 seed one random obj \, which generates the seeds for all
+the others.;
+#X obj 359 218 serialize 6;
+#X msg 360 140 6;
+#X obj 359 242 unpack f f f f f f;
+#X msg 485 317 seed \$1;
+#X obj 420 359 outlet;
+#X connect 0 0 7 0;
+#X connect 1 1 4 0;
+#X connect 2 0 1 0;
+#X connect 3 0 13 0;
+#X connect 4 0 0 0;
+#X connect 4 0 14 0;
+#X connect 5 0 7 0;
+#X connect 6 0 7 0;
+#X connect 7 0 21 0;
+#X connect 8 0 15 0;
+#X connect 9 0 16 0;
+#X connect 10 0 17 0;
+#X connect 11 0 18 0;
+#X connect 12 0 19 0;
+#X connect 13 0 22 0;
+#X connect 13 1 1 0;
+#X connect 21 0 23 0;
+#X connect 22 0 5 0;
+#X connect 23 0 8 0;
+#X connect 23 1 9 0;
+#X connect 23 2 10 0;
+#X connect 23 3 11 0;
+#X connect 23 4 12 0;
+#X connect 23 5 24 0;
+#X connect 24 0 25 0;
+#X restore 258 33 pd seedit;
+#X text 37 79 std pd random;
+#X text 197 124 linear congruential generator;
+#X text 197 77 creation arguments for the extra randoms are:;
+#X text 205 92 <range-min \, range-max> \, defaults to 0 respectively
+RAND_MAX;
+#X text 545 17 see also:;
+#X obj 545 40 utime;
+#X text 428 129 another lcg method ..;
+#X text 668 127 inverse linear congruential generator;
+#X text 536 249 normal distribution mean 0 and dist 1;
+#X text 536 264 right now it uses random1 for the actual rand values
+;
+#X text 537 278 but later on it should take one of the randoms as creation
+argument \, so yu can specify which generator is being used.;
+#X text 198 106 they all output floats);
+#X text 540 311 also \, there is some burst at the upper and lower
+limits;
+#N canvas 622 685 592 356 signalversions 1;
+#X obj 68 131 random1~;
+#X obj 368 239 tabwrite~ randomix_test;
+#N canvas 0 0 450 300 graph1 0;
+#X array randomix_test 64 float 1;
+#A 0 -0.599965 0.178987 -0.501604 -1.10592 0.426163 -0.481499 -0.553236
+0.0961931 0.554738 -0.695487 0.541875 -0.415309 -0.419922 -0.871908
+0.0688377 -1.03721 -0.136159 -0.207339 -1.18947 -0.25981 -0.628915
+-0.826873 0.334755 -0.738558 -0.0926691 -0.262739 0.309148 0.50131
+-1.40461 -0.859907 0.621724 -0.888718 0.692579 -1.11799 0.162897 0.116501
+-0.390333 0.327364 -0.902445 -0.201419 0.300071 -1.10817 -1.09973 0.34181
+-0.0511739 -0.613584 -0.306316 0.433381 -0.154481 -1.17821 -0.428187
+-0.449014 -1.04248 -0.906665 0.0687456 -1.08289 0.59097 0.0438875 -1.20429
+0.0862183 -0.995607 0.585034 0.205198 -0.337256;
+#X coords 0 1 63 -1 200 140 1;
+#X restore 351 23 graph;
+#X obj 382 183 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
+1;
+#X floatatom 440 184 5 0 0 0 - - -;
+#X obj 382 201 metro 100;
+#X msg 342 201 bang;
+#X obj 73 295 dac~;
+#X floatatom 140 220 5 0 0 0 - - -;
+#X msg 68 58 seed 30000;
+#X obj 142 131 random_fl~;
+#X text 120 98 etc ..;
+#X obj 229 131 random_icg~;
+#X obj 81 241 fader 75;
+#X connect 0 0 13 0;
+#X connect 3 0 5 0;
+#X connect 4 0 5 1;
+#X connect 5 0 1 0;
+#X connect 6 0 1 0;
+#X connect 8 0 13 2;
+#X connect 9 0 0 0;
+#X connect 10 0 13 1;
+#X connect 12 0 1 0;
+#X connect 12 0 13 0;
+#X connect 13 0 7 0;
+#X connect 13 1 7 1;
+#X restore 98 421 pd signalversions;
+#X connect 0 0 11 0;
+#X connect 1 0 11 1;
+#X connect 4 0 6 0;
+#X connect 5 0 11 2;
+#X connect 6 0 3 0;
+#X connect 7 0 12 0;
+#X connect 8 0 12 1;
+#X connect 10 0 12 2;
+#X connect 11 0 2 0;
+#X connect 12 0 9 0;
+#X connect 13 0 17 0;
+#X connect 14 0 17 1;
+#X connect 16 0 17 2;
+#X connect 17 0 15 0;
+#X connect 18 0 29 0;
+#X connect 19 0 29 1;
+#X connect 21 0 29 2;
+#X connect 23 0 29 0;
+#X connect 25 0 31 0;
+#X connect 25 0 32 0;
+#X connect 25 0 34 0;
+#X connect 26 0 33 0;
+#X connect 27 0 33 0;
+#X connect 28 0 27 0;
+#X connect 29 0 20 0;
+#X connect 30 0 27 1;
+#X connect 33 0 25 0;
+#X connect 35 0 6 0;
+#X connect 35 1 11 0;
+#X connect 35 2 12 0;
+#X connect 35 3 17 0;
+#X connect 35 4 29 0;
diff --git a/random_tw.c b/random_tw.c
new file mode 100644
index 0000000..6e7fba8
--- /dev/null
+++ b/random_tw.c
@@ -0,0 +1,181 @@
+/*
+ (c) 2002:cxc@web.fm
+ randomix: various PRNG's
+ code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html
+ let's check it out
+ */
+
+#include <m_pd.h>
+#include <stdlib.h>
+#include <math.h>
+
+#define SMALLEST_RANGE .0001
+
+#ifndef RAND_MAX
+#define RAND_MAX 2147483647
+#endif
+
+static int makeseed(void)
+{
+ static unsigned int random1_nextseed = 1489853723;
+ random1_nextseed = random1_nextseed * 435898247 + 938284287;
+ return (random1_nextseed & 0x7fffffff);
+}
+
+/* -------------------------- random_tw ------------------------------ */
+/* Combination of three tausworth generators. Has parameters for two different generators. Fast and excellent. */
+/* Combination of 3 tausworth generators -- assumes 32-bit integers */
+
+static t_class *random_tw_class;
+
+typedef struct _random_tw
+{
+ t_object x_obj;
+ t_float x_f; // lower limit
+ t_float x_g; // upper limit
+
+ t_int x_s1;
+ t_int x_s2;
+ t_int x_s3;
+
+ t_int x_mask1;
+ t_int x_mask2;
+ t_int x_mask3;
+
+ t_int x_shft1;
+ t_int x_shft2;
+ t_int x_shft3;
+ t_int x_k1;
+ t_int x_k2;
+ t_int x_k3;
+
+ t_int x_q1;
+ t_int x_q2;
+ t_int x_q3;
+ t_int x_p1;
+ t_int x_p2;
+ t_int x_p3;
+
+ unsigned int x_state; // current seed
+} t_random_tw;
+
+void random_tw_rand_seed (t_random_tw *x, unsigned int a, unsigned int b, unsigned int c)
+{
+ static unsigned int zf = 4294967295U;
+
+ x->x_shft1 = x->x_k1 - x->x_p1;
+ x->x_shft2=x->x_k2-x->x_p2;
+ x->x_shft3=x->x_k3-x->x_p3;
+ x->x_mask1 = zf << (32-x->x_k1);
+ x->x_mask2 = zf << (32-x->x_k2);
+ x->x_mask3 = zf << (32-x->x_k3);
+ if (a > (unsigned int)(1<<x->x_shft1)) x->x_s1 = a;
+ if (b > (unsigned int)(1<<x->x_shft2)) x->x_s2 = b;
+ if (c > (unsigned int)(1<<x->x_shft3)) x->x_s3 = c;
+ // rand();
+}
+
+static void *random_tw_new(t_floatarg f, t_floatarg g)
+{
+ t_random_tw *x = (t_random_tw *)pd_new(random_tw_class);
+
+ x->x_f = (f) ? f : 0;
+ x->x_g = (g) ? g : RAND_MAX;
+ //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g);
+ x->x_state = makeseed();
+
+ x->x_s1=390451501;
+ x->x_s2=613566701;
+ x->x_s3=858993401;
+
+ x->x_k1=31;
+ x->x_k2=29;
+ x->x_k3=28;
+
+ x->x_q1=13;
+ x->x_q2=2;
+ x->x_q3=3;
+ x->x_p1=12;
+ x->x_p2=4;
+ x->x_p3=17;
+
+/* x->x_q1=3; */
+/* x->x_q2=2; */
+/* x->x_q3=13; */
+/* x->x_p1=20; */
+/* x->x_p2=16; */
+/* x->x_p3=7; */
+
+ random_tw_rand_seed(x, makeseed(),makeseed(),makeseed());
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2"));
+ outlet_new(&x->x_obj, &s_float);
+ return (x);
+}
+
+
+static void random_tw_bang(t_random_tw *x)
+{
+ unsigned int b;
+ double nval;
+ static unsigned int zf = 4294967295U;
+
+ b = ((x->x_s1 << x->x_q1)^x->x_s1) >> x->x_shft1;
+ x->x_s1 = ((x->x_s1 & x->x_mask1) << x->x_p1) ^ b;
+ b = ((x->x_s2 << x->x_q2) ^ x->x_s2) >> x->x_shft2;
+ x->x_s2 = ((x->x_s2 & x->x_mask2) << x->x_p2) ^ b;
+ b = ((x->x_s3 << x->x_q3) ^ x->x_s3) >> x->x_shft3;
+ x->x_s3 = ((x->x_s3 & x->x_mask3) << x->x_p3) ^ b;
+ nval = (((double)(x->x_s1 ^ x->x_s2 ^ x->x_s3) / (double)(zf) + 0.5) * (double)(x->x_g - x->x_f) + (double)x->x_f);
+
+ //nval = ((x->x_state / (double)m) * (double)(x->x_g - x->x_f) + (double)x->x_f);
+ //post("cxc/randomix.c: current rand: %f", nval);
+ outlet_float(x->x_obj.ob_outlet, nval);
+}
+
+void random_tw_low(t_random_tw *x, t_floatarg f)
+{
+ if(f >= x->x_g) {
+ post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f",
+ SMALLEST_RANGE,
+ x->x_g - SMALLEST_RANGE);
+ x->x_f = x->x_g - SMALLEST_RANGE;
+ } else x->x_f = f;
+}
+
+void random_tw_upp(t_random_tw *x, t_floatarg f)
+{
+ if(f <= x->x_f) {
+ post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f",
+ SMALLEST_RANGE,
+ x->x_f + SMALLEST_RANGE);
+ x->x_g = x->x_f + SMALLEST_RANGE;
+ } else x->x_g = f;
+}
+
+static void random_tw_seed(t_random_tw *x, float f, float glob)
+{
+ //x->x_state = f;
+ // questionable .. dont quite get how this one's seeded ..
+ random_tw_rand_seed(x, (int)f, (int)(f*0.455777), (int)f);
+}
+
+static void random_tw_help(t_random_tw *x)
+{
+ post("RAND_MAX: %d",RAND_MAX);
+ post("range: %f - %f", x->x_f, x->x_g);
+}
+
+void random_tw_setup(void)
+{
+ random_tw_class = class_new(gensym("random_tw"), (t_newmethod)random_tw_new, 0,
+ sizeof(t_random_tw), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ class_addbang(random_tw_class, random_tw_bang);
+ class_addmethod(random_tw_class, (t_method)random_tw_low, gensym("fl1"), A_FLOAT, 0);
+ class_addmethod(random_tw_class, (t_method)random_tw_upp, gensym("fl2"), A_FLOAT, 0);
+
+ class_addmethod(random_tw_class, (t_method)random_tw_seed,
+ gensym("seed"), A_FLOAT, 0);
+ class_addmethod(random_tw_class, (t_method)random_tw_help,
+ gensym("help"), 0, 0);
+}
diff --git a/randomix.c b/randomix.c
deleted file mode 100644
index 4700766..0000000
--- a/randomix.c
+++ /dev/null
@@ -1,874 +0,0 @@
-/*
- (c) 2002:cxc@web.fm
- randomix: various PRNG's
- code taken from: http://remus.rutgers.edu/%7Erhoads/Code/code.html
- let's check it out
- */
-
-#include <m_pd.h>
-#include <stdlib.h>
-#include <math.h>
-
-#define SMALLEST_RANGE .0001
-
-#ifndef RAND_MAX
-#define RAND_MAX 2147483647
-#endif
-
-static unsigned random_icg_INVERSE_seed ();
-static int makeseed(void);
-static int rand_random1(int);
-static int rand_random_fl(int);
-static int rand_random_icg(int, int);
-static unsigned int rand_random_icg_INVERSE_seed(int, int);
-//static void random_tw_rand_seed(t_class, int, int, int);
-
-static int makeseed(void)
-{
- static unsigned int random1_nextseed = 1489853723;
- random1_nextseed = random1_nextseed * 435898247 + 938284287;
- return (random1_nextseed & 0x7fffffff);
-}
-
-/* -------------------------- random1 ------------------------------ */
-/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */
-static int rand_random1(seed)
-{
- int state;
-
- //unsigned int a = 1588635695, m = 4294967291U, q = 2, r = 1117695901;
- // unsigned int a = 1588635695, m = (RAND_MAX * 2), q = 2, r = 1117695901;
-
- /* static unsigned int a = 1223106847, m = 4294967291U, q = 3, r = 625646750;*/
- /* static unsigned int a = 279470273, m = 4294967291U, q = 15, r = 102913196;*/
- //static unsigned int a = 1583458089, m = 2147483647, q = 1, r = 564025558;
- static unsigned int a = 784588716, m = 2147483647, q = 2, r = 578306215;
- /* static unsigned int a = 16807, m = 2147483647, q = 127773, r = 2836; */
- /* static unsigned int a = 950706376, m = 2147483647, q = 2, r = 246070895; */
-
- //state = (seed) ? seed : makeseed();
- state = seed;
- state = a*(state % q) - r*(state / q);
- return (state);
-}
-
-static int rand_random_fl(seed) {
- int q;
- double state;
-
- /* The following parameters are recommended settings based on research
- uncomment the one you want. */
-
- double a = 1389796, m = RAND_MAX;
- /* static double a = 950975, m = 2147483647; */
- /* static double a = 3467255, m = 21474836472; */
- /* static double a = 657618, m = 4294967291; */
- /* static double a = 93167, m = 4294967291; */
- /* static double a = 1345659, m = 4294967291; */
-
- state = seed;
- state *= a;
- q = state / m;
- state -= q*m;
- return state;
-}
-
-static int rand_random_icg(seed, p)
-{
- static int a, b, q, r;
- int state;
- unsigned int inv;
- a = 22211, b = 11926380,q = 96685, r = 12518;
- /* static int p = 2147483053, a = 858993221, b = 1,q = 2, r = 429496611;*/
- /* static int p = 2147483053, a = 579, b = 24456079, q = 3708951, r = 424;*/
- /* static int p = 2147483053, a = 11972, b = 62187060,q = 179375, r = 5553;*/
- /* static int p = 2147483053, a = 21714, b = 94901263,q = 98898, r = 11881;*/
- /* static int p = 2147483053, a = 4594, b = 44183289,q = 467453, r = 3971;*/
- /* static int p = 2147483647, a = 1288490188, b = 1, q = 1, r = 858993459;*/
- /* static int p = 2147483647, a = 9102, b = 36884165, q = 235935, r =3277;*/
- /* static int p = 2147483647, a = 14288, b = 758634, q = 150299, r = 11535;*/
- /* static int p = 2147483647, a = 21916, b = 71499791, q = 97987, r = 555;*/
- /* static int p = 2147483647, a = 28933, b = 59217914, q = 74222, r = 18521;*/
- /* static int p = 2147483647, a = 31152, b = 48897674, q = 68935, r = 20527;*/
-
- // state = seed;
-
- inv = rand_random_icg_INVERSE_seed(seed, p);
-
- state = a*(inv % q) - r*(inv / q) + b;
-
- if (state < 0) state += p;
- else if (state >= state) state -= p;
-
- return state;
-}
-
-/* Modular Inversion using the extended Euclidean alg. for GCD */
-/***************************************************************/
-static unsigned rand_random_icg_INVERSE_seed (int state, int p)
-{
- unsigned int q,d;
- signed int u,v,inv,t;
-
- if (state <= 1) return(state);
-
- d = p; inv = 0; v = 1; u = state;
-
- do {
- q = d / u;
- t = d % u;
- d = u;
- u = t;
- t = inv - q*v;
- inv = v;
- v = t;
- } while (u != 0);
-
- if (inv < 0 ) inv += p;
-
-/* if (1 != d) */
-/* post ("inverse_iter: Can't invert !"); */
-
- return(inv);
-}
-
-/* -------------------------- random1 ------------------------------ */
-/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */
-
-static t_class *random1_class;
-
-typedef struct _random1
-{
- t_object x_obj;
- t_float x_f; // lower limit
- t_float x_g; // upper limit
- unsigned int x_state; // current seed
-} t_random1;
-
-static void *random1_new(t_floatarg f, t_floatarg g)
-{
- t_random1 *x = (t_random1 *)pd_new(random1_class);
- x->x_f = (f) ? f : 0;
- x->x_g = (g) ? g : RAND_MAX;
- //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g);
- x->x_state = makeseed();
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2"));
- outlet_new(&x->x_obj, &s_float);
- return (x);
-}
-
-/* -------------------------- random_fl ------------------------------ */
-/* An improved (faster) implementation of the Linear Congruential Generator. Has parameters for 6 separate */
-/* linear congruence formulas. These formulas are different than those above because the previous formulas won't work */
-/* correctly in this implementation. Also, this method only works if your floating point mantissa has at least 53 bits. */
-
-/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */
-/* works if your floating pt. mantissa has at least 53 bits.
- faster than other versions */
-static void random1_bang(t_random1 *x)
-{
- int n = x->x_f;
- double nval;
- unsigned int m;
- // this seems weird?
- m = (RAND_MAX * 2);
- // unsigned int a = 1588635695, m = 4294967291U, q = 2, r = 1117695901;
-
- // post("cxc/randomix.c: x_state: %d",x->x_state);
- x->x_state = rand_random1(x->x_state);
- nval = ((double)x->x_state / (double)m) * (double)(x->x_g - x->x_f) + (double)x->x_f;
- // post("cxc/randomix.c: lolim: %f, uplim: %f", x->x_f, x->x_g);
- // post("cxc/randomix.c: nval: %f",nval);
- outlet_float(x->x_obj.ob_outlet, nval);
-}
-
-void random1_low(t_random1 *x, t_floatarg f)
-{
- if(f >= x->x_g) {
- post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f",
- SMALLEST_RANGE,
- x->x_g - SMALLEST_RANGE);
- x->x_f = x->x_g - SMALLEST_RANGE;
- } else x->x_f = f;
-}
-
-void random1_upp(t_random1 *x, t_floatarg f)
-{
- if(f <= x->x_f) {
- post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f",
- SMALLEST_RANGE,
- x->x_f + SMALLEST_RANGE);
- x->x_g = x->x_f + SMALLEST_RANGE;
- } else x->x_g = f;
-}
-
-static void random1_seed(t_random1 *x, float f, float glob)
-{
- x->x_state = f;
-}
-
-void random1_setup(void)
-{
- random1_class = class_new(gensym("random1"), (t_newmethod)random1_new, 0,
- sizeof(t_random1), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addbang(random1_class, random1_bang);
- class_addmethod(random1_class, (t_method)random1_low, gensym("fl1"), A_FLOAT, 0);
- class_addmethod(random1_class, (t_method)random1_upp, gensym("fl2"), A_FLOAT, 0);
-
- class_addmethod(random1_class, (t_method)random1_seed,
- gensym("seed"), A_FLOAT, 0);
-}
-
-
-/* -------------------------- random1 ------------------------------ */
-/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */
-/* signal version */
-
-static t_class *random1_tilde_class;
-
-typedef struct _random1_tilde
-{
- t_object x_obj;
- unsigned int x_state; // current seed
-} t_random1_tilde;
-
-static void *random1_tilde_new()
-{
- t_random1_tilde *x = (t_random1_tilde *)pd_new(random1_tilde_class);
- x->x_state = makeseed();
- outlet_new(&x->x_obj, gensym("signal"));
- return (x);
-}
-
-static void random1_tilde_seed(t_random1_tilde *x, float f, float glob)
-{
- x->x_state = f;
-}
-
-static t_int *random1_tilde_perform(t_int *w)
-{
- t_random1_tilde *x = (t_random1_tilde *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- int n = (int)(w[3]);
-
- while (n--) {
- // generate new noise sample
- x->x_state = rand_random1(x->x_state);
- *out++ = (t_float)x->x_state / RAND_MAX - 1;
- }
-
- return (w+4);
-}
-
-static void random1_tilde_dsp(t_random1_tilde *x, t_signal **sp)
-{
- dsp_add(random1_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
-}
-
-void random1_tilde_setup(void)
-{
- random1_tilde_class = class_new(gensym("random1~"),
- (t_newmethod)random1_tilde_new,
- 0, sizeof(t_random1_tilde), 0, 0);
- class_addmethod(random1_tilde_class, (t_method)random1_tilde_seed,gensym("seed"), A_FLOAT, 0);
- class_addmethod(random1_tilde_class, (t_method)random1_tilde_dsp, gensym("dsp"), 0);
-}
-
-
-
-/* -------------------------- random_fl ------------------------------ */
-/* An improved (faster) implementation of the Linear Congruential Generator. Has parameters for 6 separate */
-/* linear congruence formulas. These formulas are different than those above because the previous formulas won't work */
-/* correctly in this implementation. Also, this method only works if your floating point mantissa has at least 53 bits. */
-
-/* linear congruential generator. Generator x[n+1] = a * x[n] mod m */
-/* works if your floating pt. mantissa has at least 53 bits.
- faster than other versions */
-
-static t_class *random_fl_class;
-
-typedef struct _random_fl
-{
- t_object x_obj;
- t_float x_f; // lower limit
- t_float x_g; // upper limit
- unsigned int x_state; // current seed
-} t_random_fl;
-
-static void *random_fl_new(t_floatarg f, t_floatarg g)
-{
- t_random_fl *x = (t_random_fl *)pd_new(random_fl_class);
- x->x_f = (f) ? f : 0;
- x->x_g = (g) ? g : RAND_MAX;
- //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g);
- x->x_state = makeseed();
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2"));
- outlet_new(&x->x_obj, &s_float);
- return (x);
-}
-
-void random_fl_bang(t_random_fl *x)
-{
- int n = x->x_f;
- int q;
- double nval;
- double m;
-
- m = RAND_MAX;
- x->x_state = rand_random_fl(x->x_state);
- nval = ((x->x_state / m) * (double)(x->x_g - x->x_f) + (double)x->x_f);
- outlet_float(x->x_obj.ob_outlet, nval);
-}
-
-void random_fl_low(t_random_fl *x, t_floatarg f)
-{
- if(f >= x->x_g) {
- post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f",
- SMALLEST_RANGE,
- x->x_g - SMALLEST_RANGE);
- x->x_f = x->x_g - SMALLEST_RANGE;
- } else x->x_f = f;
-}
-
-void random_fl_upp(t_random_fl *x, t_floatarg f)
-{
- if(f <= x->x_f) {
- post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f",
- SMALLEST_RANGE,
- x->x_f + SMALLEST_RANGE);
- x->x_g = x->x_f + SMALLEST_RANGE;
- } else x->x_g = f;
-}
-
-static void random_fl_seed(t_random_fl *x, float f, float glob)
-{
- x->x_state = f;
-}
-
-void random_fl_setup(void)
-{
- random_fl_class = class_new(gensym("random_fl"), (t_newmethod)random_fl_new, 0,
- sizeof(t_random_fl), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addbang(random_fl_class, random_fl_bang);
- class_addmethod(random_fl_class, (t_method)random_fl_low, gensym("fl1"), A_FLOAT, 0);
- class_addmethod(random_fl_class, (t_method)random_fl_upp, gensym("fl2"), A_FLOAT, 0);
-
- class_addmethod(random_fl_class, (t_method)random_fl_seed,
- gensym("seed"), A_FLOAT, 0);
-}
-
-/* ------------------------------- random_fl signal version -------------------- */
-
-static t_class *random_fl_tilde_class;
-
-typedef struct _random_fl_tilde
-{
- t_object x_obj;
- unsigned int x_state; // current seed
-} t_random_fl_tilde;
-
-static void *random_fl_tilde_new()
-{
- t_random_fl_tilde *x = (t_random_fl_tilde *)pd_new(random_fl_tilde_class);
- x->x_state = makeseed();
- outlet_new(&x->x_obj, gensym("signal"));
- return (x);
-}
-
-static void random_fl_tilde_seed(t_random_fl_tilde *x, float f, float glob)
-{
- x->x_state = f;
-}
-
-static t_int *random_fl_tilde_perform(t_int *w)
-{
- t_random_fl_tilde *x = (t_random_fl_tilde *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- int n = (int)(w[3]);
-
- while (n--) {
- // generate new noise sample
- x->x_state = rand_random_fl(x->x_state);
- *out++ = (t_float)x->x_state / RAND_MAX * 2 - 1;
- }
-
- return (w+4);
-}
-
-static void random_fl_tilde_dsp(t_random_fl_tilde *x, t_signal **sp)
-{
- dsp_add(random_fl_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
-}
-
-void random_fl_tilde_setup(void)
-{
- random_fl_tilde_class = class_new(gensym("random_fl~"),
- (t_newmethod)random_fl_tilde_new, 0,
- sizeof(t_random_fl_tilde), 0, 0);
- class_addmethod(random_fl_tilde_class, (t_method)random_fl_tilde_seed,
- gensym("seed"), A_FLOAT, 0);
- class_addmethod(random_fl_tilde_class, (t_method)random_fl_tilde_dsp, gensym("dsp"), 0);
-}
-
-
-
-
-/* -------------------------- random_icg ------------------------------ */
-/* Inverse Congruential generator. This generator is quite a bit slower than the other ones on this page. and it */
-/* fails some statistical tests. The main factor in its favor is that its properties tend to be the opposite of linear congruential */
-/* generators. I.e. this generator is very likely to be good for those applications where linear congruential generators are */
-/* bad. You can choose among several parameters. */
-
-/* inversive congruential generator. */
-
-static t_class *random_icg_class;
-
-typedef struct _random_icg
-{
- t_object x_obj;
- t_float x_f; // lower limit
- t_float x_g; // upper limit
- t_float x_p; // 1st shared parameter of iter function ..
- unsigned int x_state; // current seed
-} t_random_icg;
-
-static void *random_icg_new(t_floatarg f, t_floatarg g)
-{
- t_random_icg *x = (t_random_icg *)pd_new(random_icg_class);
- x->x_f = (f) ? f : 0;
- x->x_g = (g) ? g : RAND_MAX;
- x->x_p = 2147483053;
- //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g);
- x->x_state = makeseed();
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2"));
- outlet_new(&x->x_obj, &s_float);
- return (x);
-}
-
-static void random_icg_bang(t_random_icg *x)
-{
- double nval;
-
- x->x_state = rand_random_icg(x->x_state, x->x_p);
-
- nval = (((x->x_state / x->x_p) - 1) * (double)(x->x_g - x->x_f) + (double)x->x_f);
-
- // hakc, why is it out of range?
- if(nval < (double)x->x_f) {
- random_icg_bang(x);
- } else {
- outlet_float(x->x_obj.ob_outlet, nval);
- }
-}
-
-void random_icg_low(t_random_icg *x, t_floatarg f)
-{
- if(f >= x->x_g) {
- post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f",
- SMALLEST_RANGE,
- x->x_g - SMALLEST_RANGE);
- x->x_f = x->x_g - SMALLEST_RANGE;
- } else x->x_f = f;
-}
-
-void random_icg_upp(t_random_icg *x, t_floatarg f)
-{
- if(f <= x->x_f) {
- post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f",
- SMALLEST_RANGE,
- x->x_f + SMALLEST_RANGE);
- x->x_g = x->x_f + SMALLEST_RANGE;
- } else x->x_g = f;
-}
-
-static void random_icg_seed(t_random_icg *x, float f, float glob)
-{
- x->x_state = f;
-}
-
-void random_icg_setup(void)
-{
- random_icg_class = class_new(gensym("random_icg"), (t_newmethod)random_icg_new, 0,
- sizeof(t_random_icg), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addbang(random_icg_class, random_icg_bang);
- class_addmethod(random_icg_class, (t_method)random_icg_low, gensym("fl1"), A_FLOAT, 0);
- class_addmethod(random_icg_class, (t_method)random_icg_upp, gensym("fl2"), A_FLOAT, 0);
-
- class_addmethod(random_icg_class, (t_method)random_icg_seed,
- gensym("seed"), A_FLOAT, 0);
-}
-
-
-/* -------------------------- random_icg ------------------------------ */
-/* inverse congruential generator. */
-
-static t_class *random_icg_tilde_class;
-
-typedef struct _random_icg_tilde
-{
- t_object x_obj;
- t_float x_f; // lower limit
- t_float x_g; // upper limit
- t_float x_p; // 1st shared parameter of iter function ..
- unsigned int x_state; // current seed
-} t_random_icg_tilde;
-
-static void *random_icg_tilde_new()
-{
- t_random_icg_tilde *x = (t_random_icg_tilde *)pd_new(random_icg_tilde_class);
-/* x->x_f = (f) ? f : 0; */
-/* x->x_g = (g) ? g : RAND_MAX; */
- x->x_p = 2147483053;
- //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g);
- x->x_state = makeseed();
- outlet_new(&x->x_obj, gensym("signal"));
- return (x);
-}
-
-static void random_icg_tilde_bang(t_random_icg_tilde *x)
-{
- double nval;
-
- x->x_state = rand_random_icg(x->x_state, x->x_p);
-
- nval = (((x->x_state / x->x_p) - 1) * (double)(x->x_g - x->x_f) + (double)x->x_f);
-
- // hakc, why is it out of range?
- if(nval < (double)x->x_f) {
- random_icg_tilde_bang(x);
- } else {
- outlet_float(x->x_obj.ob_outlet, nval);
- }
-}
-
-static void random_icg_tilde_seed(t_random_icg_tilde *x, float f, float glob)
-{
- x->x_state = f;
-}
-
-static t_int *random_icg_tilde_perform(t_int *w)
-{
- t_random_icg_tilde *x = (t_random_icg_tilde *)(w[1]);
- t_float *out = (t_float *)(w[2]);
- int n = (int)(w[3]);
-
- while (n--) {
- // generate new noise sample
- x->x_state = rand_random_icg(x->x_state, x->x_p);
- *out++ = (t_float)(x->x_state / x->x_p - 1) * 2 - 1;
- }
-
- return (w+4);
-}
-
-
-static void random_icg_tilde_dsp(t_random_icg_tilde *x, t_signal **sp)
-{
- dsp_add(random_icg_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
-}
-
-
-void random_icg_tilde_setup(void)
-{
- random_icg_tilde_class = class_new(gensym("random_icg~"), (t_newmethod)random_icg_tilde_new, 0,
- sizeof(t_random_icg_tilde), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addmethod(random_icg_tilde_class, (t_method)random_icg_tilde_seed,
- gensym("seed"), A_FLOAT, 0);
- class_addmethod(random_icg_tilde_class, (t_method)random_icg_tilde_dsp, gensym("dsp"), 0);
-}
-
-
-
-/* -------------------------- random_tw ------------------------------ */
-/* Combination of three tausworth generators. Has parameters for two different generators. Fast and excellent. */
-/* Combination of 3 tausworth generators -- assumes 32-bit integers */
-
-static t_class *random_tw_class;
-
-typedef struct _random_tw
-{
- t_object x_obj;
- t_float x_f; // lower limit
- t_float x_g; // upper limit
-
- t_int x_s1;
- t_int x_s2;
- t_int x_s3;
-
- t_int x_mask1;
- t_int x_mask2;
- t_int x_mask3;
-
- t_int x_shft1;
- t_int x_shft2;
- t_int x_shft3;
- t_int x_k1;
- t_int x_k2;
- t_int x_k3;
-
- t_int x_q1;
- t_int x_q2;
- t_int x_q3;
- t_int x_p1;
- t_int x_p2;
- t_int x_p3;
-
- unsigned int x_state; // current seed
-} t_random_tw;
-
-void random_tw_rand_seed (t_random_tw *x, unsigned int a, unsigned int b, unsigned int c)
-{
- static unsigned int zf = 4294967295U;
-
- x->x_shft1 = x->x_k1 - x->x_p1;
- x->x_shft2=x->x_k2-x->x_p2;
- x->x_shft3=x->x_k3-x->x_p3;
- x->x_mask1 = zf << (32-x->x_k1);
- x->x_mask2 = zf << (32-x->x_k2);
- x->x_mask3 = zf << (32-x->x_k3);
- if (a > (unsigned int)(1<<x->x_shft1)) x->x_s1 = a;
- if (b > (unsigned int)(1<<x->x_shft2)) x->x_s2 = b;
- if (c > (unsigned int)(1<<x->x_shft3)) x->x_s3 = c;
- // rand();
-}
-
-static void *random_tw_new(t_floatarg f, t_floatarg g)
-{
- t_random_tw *x = (t_random_tw *)pd_new(random_tw_class);
-
- x->x_f = (f) ? f : 0;
- x->x_g = (g) ? g : RAND_MAX;
- //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g);
- x->x_state = makeseed();
-
- x->x_s1=390451501;
- x->x_s2=613566701;
- x->x_s3=858993401;
-
- x->x_k1=31;
- x->x_k2=29;
- x->x_k3=28;
-
- x->x_q1=13;
- x->x_q2=2;
- x->x_q3=3;
- x->x_p1=12;
- x->x_p2=4;
- x->x_p3=17;
-
-/* x->x_q1=3; */
-/* x->x_q2=2; */
-/* x->x_q3=13; */
-/* x->x_p1=20; */
-/* x->x_p2=16; */
-/* x->x_p3=7; */
-
- random_tw_rand_seed(x, makeseed(),makeseed(),makeseed());
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2"));
- outlet_new(&x->x_obj, &s_float);
- return (x);
-}
-
-
-static void random_tw_bang(t_random_tw *x)
-{
- unsigned int b;
- double nval;
- static unsigned int zf = 4294967295U;
-
- b = ((x->x_s1 << x->x_q1)^x->x_s1) >> x->x_shft1;
- x->x_s1 = ((x->x_s1 & x->x_mask1) << x->x_p1) ^ b;
- b = ((x->x_s2 << x->x_q2) ^ x->x_s2) >> x->x_shft2;
- x->x_s2 = ((x->x_s2 & x->x_mask2) << x->x_p2) ^ b;
- b = ((x->x_s3 << x->x_q3) ^ x->x_s3) >> x->x_shft3;
- x->x_s3 = ((x->x_s3 & x->x_mask3) << x->x_p3) ^ b;
- nval = (((double)(x->x_s1 ^ x->x_s2 ^ x->x_s3) / (double)(zf) + 0.5) * (double)(x->x_g - x->x_f) + (double)x->x_f);
-
- //nval = ((x->x_state / (double)m) * (double)(x->x_g - x->x_f) + (double)x->x_f);
- //post("cxc/randomix.c: current rand: %f", nval);
- outlet_float(x->x_obj.ob_outlet, nval);
-}
-
-void random_tw_low(t_random_tw *x, t_floatarg f)
-{
- if(f >= x->x_g) {
- post("cxc/randomix.c: lower larger than upper, setting to upper - %f = %f",
- SMALLEST_RANGE,
- x->x_g - SMALLEST_RANGE);
- x->x_f = x->x_g - SMALLEST_RANGE;
- } else x->x_f = f;
-}
-
-void random_tw_upp(t_random_tw *x, t_floatarg f)
-{
- if(f <= x->x_f) {
- post("cxc/randomix.c: upper smaller than lower, setting to lower + %f = %f",
- SMALLEST_RANGE,
- x->x_f + SMALLEST_RANGE);
- x->x_g = x->x_f + SMALLEST_RANGE;
- } else x->x_g = f;
-}
-
-static void random_tw_seed(t_random_tw *x, float f, float glob)
-{
- //x->x_state = f;
- // questionable .. dont quite get how this one's seeded ..
- random_tw_rand_seed(x, (int)f, (int)(f*0.455777), (int)f);
-}
-
-static void random_tw_help(t_random_tw *x)
-{
- post("RAND_MAX: %d",RAND_MAX);
- post("range: %f - %f", x->x_f, x->x_g);
-}
-
-void random_tw_setup(void)
-{
- random_tw_class = class_new(gensym("random_tw"), (t_newmethod)random_tw_new, 0,
- sizeof(t_random_tw), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addbang(random_tw_class, random_tw_bang);
- class_addmethod(random_tw_class, (t_method)random_tw_low, gensym("fl1"), A_FLOAT, 0);
- class_addmethod(random_tw_class, (t_method)random_tw_upp, gensym("fl2"), A_FLOAT, 0);
-
- class_addmethod(random_tw_class, (t_method)random_tw_seed,
- gensym("seed"), A_FLOAT, 0);
- class_addmethod(random_tw_class, (t_method)random_tw_help,
- gensym("help"), 0, 0);
-}
-
-
-
-
-/* -------------------------- dist_normal ------------------------------ */
-/* Generate a normal random variable with mean 0 and standard deviation
- of 1. To adjust to some other distribution, multiply by the standard
- deviation and add the mean. Box-Muller method
- note: rand() is a function that returns a uniformly distributed random
- number from 0 to RAND_MAX
-*/
-
-static t_class *dist_normal_class;
-
-typedef struct _dist_normal
-{
- t_object x_obj;
- t_float x_mn; // mean
- t_float x_dv; // deviation
- t_float x_u1;
- t_float x_u2;
-
- t_float x_f; // lower limit
- t_float x_g; // upper limit
- unsigned int x_state; // current seed
-} t_dist_normal;
-
-static void *dist_normal_new(t_floatarg mn, t_floatarg dv)
-{
- t_dist_normal *x = (t_dist_normal *)pd_new(dist_normal_class);
- x->x_mn = (mn) ? mn : 0;
- x->x_dv = (dv) ? dv : 1;
- x->x_u1 = 13;
- x->x_u2 = 1000;
- x->x_f = 0;
- x->x_g = RAND_MAX;
- //post("cxc/randomix.c: lolim: %f - %f, uplim: %f - %f", x->x_f, f, x->x_g, g);
- x->x_state = makeseed();
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl1"));
- // inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_float, gensym("fl2"));
- //outlet_new(&x->x_obj, &s_float);
- outlet_new(&x->x_obj, 0);
- return (x);
-}
-
-static double dist_normal_rand(t_dist_normal *x)
-{
- int n = x->x_f;
- double nval;
- double m;
-
- m = (double)RAND_MAX * 2;
-
- // post("cxc/randomix.c: x_state: %d",x->x_state);
- x->x_state = rand_random_fl(x->x_state);
- //nval = ((double)x->x_state / m) * (double)(x->x_g - x->x_f) + (double)x->x_f;
- nval = (double)x->x_state;
- return (nval);
-}
-
-static void dist_normal_doit(t_dist_normal *x)
-{
- static double V2, fac;
- static int phase = 0;
- double S, Z, U1, U2, V1;
-
- if (phase)
- Z = V2 * fac;
- else
- {
- do {
-/* U1 = (double)rand() / RAND_MAX; */
-/* U2 = (double)rand() / RAND_MAX; */
- U1 = (double)dist_normal_rand(x) / RAND_MAX;
- U2 = (double)dist_normal_rand(x) / RAND_MAX;
-
- // post("cxc/randomix.c: test %f %f %f %f", x->x_u1, x->x_u2, U1, U2);
-
- V1 = 2 * U1 - 1;
- V2 = 2 * U2 - 1;
- S = V1 * V1 + V2 * V2;
- } while(S >= 1);
-
- fac = sqrt (-2 * log(S) / S);
- Z = V1 * fac;
- }
-
- phase = 1 - phase;
-
- //return Z;
- outlet_float(x->x_obj.ob_outlet, Z);
-}
-
-static void dist_normal_bang(t_dist_normal *x)
-{
-/* post("cxc/randomix.c: dist_normal banged"); */
-/* post("cxc/randomix.c: RAND_MAX: %d",RAND_MAX); */
-/* post("cxc/randomix.c: test: %f %f", x->x_u1, x->x_u2); */
- dist_normal_doit(x);
-}
-
-void dist_normal_low(t_dist_normal *x, t_floatarg mn)
-{
- x->x_mn = mn;
-}
-
-void dist_normal_upp(t_dist_normal *x, t_floatarg dv)
-{
- x->x_dv = dv;
-}
-
-void dist_normal_float(t_dist_normal *x, t_floatarg r)
-{
- outlet_float(x->x_obj.ob_outlet, r);
-}
-
-void dist_normal_list(t_dist_normal *x, t_symbol *s, int argc, t_atom *argv)
-{
- outlet_list(x->x_obj.ob_outlet, s, argc, argv);
-}
-
-void dist_normal_setup(void)
-{
- dist_normal_class = class_new(gensym("dist_normal"), (t_newmethod)dist_normal_new, 0,
- sizeof(t_dist_normal), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
- class_addbang(dist_normal_class, dist_normal_bang);
- class_addmethod(dist_normal_class, (t_method)dist_normal_low, gensym("fl1"), A_FLOAT, 0);
- // class_addmethod(dist_normal_class, (t_method)dist_normal_upp, gensym("fl2"), A_FLOAT, 0);
- class_addlist (dist_normal_class, dist_normal_list);
-
-/* class_addmethod(dist_normal_class, (t_method)dist_normal_seed, */
-/* gensym("seed"), A_FLOAT, 0); */
-}
diff --git a/reference/reson~-help.pd b/reson~-help.pd
index d90c159..d90c159 100644
--- a/reference/reson~-help.pd
+++ b/reson~-help.pd
diff --git a/reference/serialize-help.pd b/serialize-help.pd
index b9d8469..b9d8469 100644
--- a/reference/serialize-help.pd
+++ b/serialize-help.pd
diff --git a/reference/utime-help.pd b/utime-help.pd
index aa5af83..aa5af83 100644
--- a/reference/utime-help.pd
+++ b/utime-help.pd