| 1 | #cxx . . $ `<file>/melder/NUMrandom.h`/ifndef _NUMrandom_h_ |
| 2 | #define _NUMrandom_h_cxx . . $ `melder/NUMrandom.h:2:9`! |
| 3 | /* NUMrandom.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2018,2020,2025,2026 Paul Boersma |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | * See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | /********** Random numbers **********/ |
| 22 | |
| 23 | void NUMrandom_initializeSafelyAndUnpredictablycxx . . $ NUMrandom_initializeSafelyAndUnpredictably(49f6e7a06ebc5aa8). (); |
| 24 | void NUMrandom_initializeWithSeedUnsafelyButPredictablycxx . . $ NUMrandom_initializeWithSeedUnsafelyButPredictably(2c44cd906ae4e829). (uint64cxx . . $ uint64# seed); |
| 25 | |
| 26 | constexpr integercxx . . $ integer# NUMrandom_maximumNumberOfParallelThreadscxx . . $ NUMrandom_maximumNumberOfParallelThreads. = 400; |
| 27 | // The number of random channels will be three more than this: |
| 28 | // thread 0: the thread in which Praat commands and Praat scripts run |
| 29 | // threads 1 through 399 or 400: extra threads for parallellization in analyses (the master thread stays 0) |
| 30 | // thread 401: user-interface randomization (not really a thread) |
| 31 | // thread 402: spare "thread" |
| 32 | constexpr integercxx . . $ integer# NUMrandom_numberOfChannelscxx . . $ NUMrandom_numberOfChannels. = NUMrandom_maximumNumberOfParallelThreadscxx . . $ NUMrandom_maximumNumberOfParallelThreads. + 3; |
| 33 | |
| 34 | void NUMrandom_setChannelcxx . . $ NUMrandom_setChannel(1624ee8275b10bda). (integercxx . . $ integer# channelNumber); |
| 35 | // To be set by each parallel thread to a value between 0 and NUMrandom_numberOfChannels - 1. |
| 36 | void NUMrandom_useUserInterfaceChannelcxx . . $ NUMrandom_useUserInterfaceChannel(49f6e7a06ebc5aa8). (); |
| 37 | // Sets the channel number in the current thread to 401 |
| 38 | void NUMrandom_useSpareChannelcxx . . $ NUMrandom_useSpareChannel(49f6e7a06ebc5aa8). (); |
| 39 | // Sets the channel number in the current thread to 402 |
| 40 | integercxx . . $ integer# NUMrandom_getChannelcxx . . $ NUMrandom_getChannel(da6335ded91d79c2). (); |
| 41 | // Returns the random channel associated with the current thread (rarely useful, but who knows); |
| 42 | // only to be called after one of the three channel-settings functions has been called. |
| 43 | |
| 44 | double NUMrandomFractioncxx . . $ NUMrandomFraction(31fa7155c10fdd13). (); |
| 45 | |
| 46 | double NUMrandomUniformcxx . . $ NUMrandomUniform(d8e7e0733fa41c87). (double lowest, double highest); |
| 47 | |
| 48 | integercxx . . $ integer# NUMrandomIntegercxx . . $ NUMrandomInteger(d0a0e4c270da0eca). (integercxx . . $ integer# lowest, integercxx . . $ integer# highest); |
| 49 | |
| 50 | bool NUMrandomBernoullicxx . . $ NUMrandomBernoulli(f8197d536af80c96). (double probability); |
| 51 | double NUMrandomBernoulli_realcxx . . $ NUMrandomBernoulli_real(447c67c6676f75c3). (double probability); |
| 52 | |
| 53 | double NUMrandomImaxcxx . . $ NUMrandomImax(fa513f1eb826a064). (constVECVUcxx . . $ constVECVU# const& vec); |
| 54 | |
| 55 | double NUMrandomGausscxx . . $ NUMrandomGauss(d8e7e0733fa41c87). (double mean, double standardDeviation); |
| 56 | |
| 57 | double NUMrandomPoissoncxx . . $ NUMrandomPoisson(447c67c6676f75c3). (double mean); |
| 58 | |
| 59 | uint32cxx . . $ uint32# NUMhashStringcxx . . $ NUMhashString(b796fbb641f7a7a8). (conststring32cxx . . $ conststring32# string); |
| 60 | |
| 61 | /* End of file NUMrandom.h */ |
| 62 | #endif |