Debian Codegraph @

gcc/testsuite/gm2/examples/map/pass/Chance.def

raw
1 (* Copyright (C) 2005-2025 Free Software Foundation, Inc. *)
2 (* This file is part of GNU Modula-2.
3
4 GNU Modula-2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 3, or (at your option) any later
7 version.
8
9 GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License along
15 with gm2; see the file COPYING. If not, write to the Free Software
16 Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *)
17 DEFINITION MODULE Chance ;
18
19 (*
20 Title : Chance
21 Author : Gaius Mulley
22 Date : 19/7/88
23 LastEdit : 19/7/88
24 System : LOGITECH MODULA-2/86
25 Description: Provides a set of utilities for random numbers.
26 *)
27
28 EXPORT QUALIFIED InitRandom, KillRandom,
29 GetAndDeleteRandom, AddRandom, GetRand ;
30
31 (*
32 InitRandom - Initializes a potential list of random numbers.
33 An index to this potential random number list is returned.
34 *)
35
36 PROCEDURE InitRandom () : CARDINAL ;
37
38
39 (*
40 KillRandom - Kills a complete list of random numbers.
41 *)
42
43 PROCEDURE KillRandom (RandomListIndex: CARDINAL) ;
44
45
46 (*
47 GetAndDeleteRandom - Returns a random number from the
48 list and then it is deleted.
49 Numbers 1..n will be returned if they exist,
50 if 0 is returned then the list is empty.
51 *)
52
53 PROCEDURE GetAndDeleteRandom (RandomListIndex: CARDINAL) : CARDINAL ;
54
55
56 (*
57 AddRandom - places a list of numbers 1..n into the specified list.
58 *)
59
60 PROCEDURE AddRandom (RandomListIndex: CARDINAL; n: CARDINAL) ;
61
62
63 (*
64 GetRand - returns a number between 0..n-1.
65 This routine is independant from the above routines.
66 *)
67
68 PROCEDURE GetRand (n: CARDINAL) : CARDINAL ;
69
70
71 END Chance.