I'm sorry to bother you I know this question have been asked quite a lot but never with Ada... I was wondering if there were in the Ada standard library a way to generate a list of unique random numbers (you never pick twice the same number) in O(n)
In a way is there an implementation of the Knuth-Fisher-Yates algorithm in Ada?
There's a discussion of implementing the Fisher–Yates shuffle here. Basically, you need a different range of Discrete_Random in each iteration, as shown here; Float_Random is an alternative, as mentioned in A.5.2(50), Note 16. If bias isn't critical, this example may be sufficient.
In any case, shuffling is O(n), but selecting can be O(1).
Addendum: The complexity of creating the set depends on the implementation. For example, Containers.Hashed_Sets, A.18.8(88/2) and Containers.Ordered_Sets, A.18.9(116/2).
Given that you want:
a) Random numbers from 0 to 1000
and
b) the numbers are not to repeat
according to the link you provided, you could do this rather easily.
Just fill an array with the range of values and perform some number of swaps on randomly chosen elements thereof; this guarantees both requirements are upheld.
I took the liberty of coding it up.
You'll need to With Ada.Numerics.Discrete_Random.
Generic
Low, High : Integer;
Package Initialization is
SubType Element is Integer Range Low..High;
Function Incrementor Return Element;
Type Element_Array is Array(Element) of Element;
Values : Element_Array;
Procedure Print;
End Initialization;
Package Body Initialization is
Count : Element := Element'Last;
Function Incrementor Return Element is
begin
Return Result : Element:= Count do
Null;
Count:= Element'Pred( Result );
Exception
When Constraint_Error => Count:= Element'Last;
End Return;
end Incrementor;
Procedure Swap( Index_1, Index_2 : In Integer ) is
Temp : Constant Element:= Values( Integer(Index_1) );
begin
Values( Integer(Index_1) ):= Values( Integer(Index_2) );
Values( Integer(Index_2) ):= Temp;
end Swap;
Procedure Print is
begin
Put_Line( "Length: " & Values'Length'Img );
Put( "(" );
For Index in Values'First..Integer'Pred(Values'Last) loop
Put( Values(Index)'Img & ',' );
end loop;
Put( Values(Values'Last)'Img );
Put_Line( ")" );
end Print;
Begin
Shuffle:
Declare
Package Random_Element is New
Ada.Numerics.Discrete_Random( Element );
Number : Random_Element.Generator;
Use Random_Element;
Begin
Values:= Element_Array'( Others => Incrementor );
Reset( Number );
For Index in Element'Range loop
Swap( Integer(Index), Integer(Random(Number)) );
end loop;
End Shuffle;
End Initialization;
And you can test it out with something like:
Test:
Declare
Package Q is new
Initialization( Low => 0, High => 1000 );
Begin
Q.Print;
End Test;
Related
What I want to do doesn't seem particularly complex, but I can't think of a simple way to do it in VHDL.
I have a component with a generic parameter called FOO. I would like to generate 16 of these components and for the first 8 instances I want FOO to be set to 0 and the other 8 instances I want FOO to be set to 4096.
Ideally, I would be able to do something like this:
generate_loop: for I in 0 to 15 generate
begin
comp_inst: my_component
generic map
(
FOO => 0 when I < 8 else 4096
)
port map
(
...
);
end generate;
This is of course not valid VHDL, but that captures the idea of what I'd like to do.
So my question is: is there a way to implement this in a single generate loop (i.e. without having to have 2 separate generate loops with different indices), and if so, how do I do it?
As user1155120 mentions in the comments, the base type of a for-loop is a universal integer. The fractional part of an integer division will be truncated. You can use this fact to realize your specific system, as
for 0<=i<8, i/8=0
for 8<=i<15, i/8=1
Thus the code could be
generate_loop: for I in 0 to 15 generate
begin
comp_inst: entity work.my_component
generic map (FOO => 4096 * (I/8))
port map (
...
);
end generate;
Alternatively, especially useful for more complex situations, you could do what Brian Drummond suggested: write a function
architecture arch of ent is
function gen_FOO(I : natural) return natural is begin
if I<8 then
return 0;
else
return 4096;
end if;
end function;
begin
generate_loop: for I in 0 to 15 generate
begin
comp_inst: entity work.my_component
generic map (FOO => gen_FOO(I))
port map (
...
);
end generate;
I want to loop over an array and check, whether the current array index is a value of an enumeration. The array as well as the enumeration are defined as the following:
type Option is (None, A, B, C, D);
type Votes is array(Option) of Natural;
Zero_Option_Distribution: constant Votes := (others => 0);
Votes_Distribution: Votes := Zero_Option_Distribution;
The Loop looks like this:
for I in Voting_System.Votes_Distribution'Range loop
-- this is where I would like to check whether I is a representation of either of the enum values
end loop;
I already tried everything that came to my mind, like
if I = Voting_System.Option(None) then -- ...
and
if I'Val("None") then -- ...
and some more versions where each of them didn't work.
I really don't have any more ideas to achieve this.
You compare values of objects of enumeration types just like objects of any other type, using =:
if I = None then
...
end if;
-- this is where I would like to check whether I is a representation of either of the enum values
Based on this line in your question, I assume Party is an Integer subtype or something? You should be able to just use something like this:
-- (Checks if I is 0)
if (Integer(I) = Voting_System.Option'Pos(Voting_System.Option.None)) then
-- ...
If Party is a distinct type, in accordance with ARM95 3.5.1 §7 and ARM95 Annex K §175 you may try something like this:
for I in Votes_Distribution'Range loop
case Party'Pos (I) is
when Option'Pos (None) => Put_Line (I'Img & " is for «None»");
when Option'Pos (A) => Put_Line (I'Img & " is for «A»");
when Option'Pos (B) => Put_Line (I'Img & " is for «B»");
when Option'Pos (C) => Put_Line (I'Img & " is for «C»");
when Option'Pos (D) => Put_Line (I'Img & " is for «D»");
when others => Put_Line ("I not in Option");
end case;
end loop;
Need others in all cases because we moved to work with type Universal_Integer.
I'm very new to Pascal and still learning much. I have to write a code that :
Takes input of a string
Split the string into two characters each (Snippet)
Use the Snippet to get an index from an array
Transpose the Snippet to a certain value
If Index + Transpose is larger than the length of the Array, return nothing
If not, append the transposed Snippet to a result string
Return the transposed string
I can only write 1 through 3, the rest is still a blur for me. Helps are appreciated.
(And I also want to improve it without many for loops. Any thoughts?)
program TransposeString;
var
melody : Array[1..24] of String[2] = ('c.', 'c#', 'd.', 'd#', 'e.', 'f.', 'f#', 'g.', 'g#', 'a.', 'a#', 'b.', 'C.', 'C#', 'D.', 'D#', 'E.', 'F.', 'F#', 'G.', 'G#', 'A.', 'A#', 'B.');
songstring, transposedstring : String;
transposevalue : byte;
function Transpose(song : String; transposevalue : byte): String;
var
songsnippet : String[2];
iter_song, iter_index, index : byte;
begin
for iter_song := 1 to length(song) do
begin
if iter_song mod 2 = 0 then continue;
songsnippet := song[iter_song] + song[iter_song + 1]; //Split the string into 2 characters each
for iter_index := 1 to 24 do
begin
if melody[iter_index] = songsnippet then
begin
index := iter_index; //Get Index
break;
end;
end;
//Check Transpose + Index
//Transpose Snippet
//Append Snippet to Result String
end;
end;
begin
readln(songstring);
readln(transposevalue);
transposedstring := transpose(songstring, transposevalue);
writeln(transposedstring);
end.
As a starter for you to work from, rather than just spoon-feeding an answer:
You have the index of the snippet (note) in index. Assuming the notes are in order you need to return the note from the array positions above it, so
result := result + melody[iter_index + transposevalue];
You need to check the length of the array before trying to read from it, otherwise it'll crash (step 5). This is just an if statement.
I wouldn't worry too much about for loops - 2 deep nesting isn't that bad. If you wanted to split it out a bit then GetTransposedNote(const note:string): string; could be split out as a new function.
Things you may want to think about are:
What if you can't find the note in the array?
Do you want to be case-sensitive
What if the input string has an odd number of characters?
You are most of the way there already, though.
I developed the following sorting algorithm but there are some run time errors that I cant figure out. The program terminates when it comes to the part of filling the array. I'm still a beginner in ada so I couldn't figure out where the problem is...
With Ada.Text_IO;
With Ada.Integer_Text_IO;
Use Ada.Integer_Text_IO;
Use Ada.Text_IO;
Procedure sort is
n,i,x : Integer;
-- Max_Heapify Function...
Procedure Max_Heapify ( i, n : integer) is
j, Temp : Integer;
begin
Temp:=Int_Acc(i);
j:=2*i;
if Temp>Int_Acc(j) then
elsif Temp<=Int_Acc(j) then
Int_Acc(j/2):=Int_Acc(j);
j:=2*j;
end if;
end loop;
Int_Acc(j/2):=Temp;
end Max_Heapify;
begin
Get(n);
for i in MyArr'range loop
Put_Line("Enter Element " & Integer'Image(i));
Get(MyArr(i));
end loop;
end;
end sort;
Thanks in advance :)
Your Problem is that you are insisting on writing Ada code using c - Style programming paradigms.
Firstly:
The declarations:
Type Arr is array(1..20) of Integer;
Type int_access is access Arr;
MyArr : int_access;
Where you use Int_Acc : in out int_access as parameters to procedures are useless in Ada. You are trying to pass a pointer to an array in (which you are doing!), but you should just pass your Type Arr as in out - The Ada compiler knows to do this as a pointer!
Secondly:
I cannot see where you actually allocate any memory to MyArr. This is a possible source of your runtime error. (when you write to or index an array that does not exist, i would expect to have a problem!)
Thirdly:
You seem to be mixing fixed length arrays with variable length input. If N > 20, you will have a problem.
Fourthly:
Insulting the language is not the best way of getting help from those who like it.
NWS has nailed it : there is a pointer, but no array there.
But it's clear that you have learned C, which leaves you with a lot to learn about other languages including Ada. There really are better ways of doing many things, that aren't taught to C programmers because C doesn't allow them.
Allocating variable sized arrays without pointers, malloc and free for example...
Type Arr is array(positive range <>) of Integer; -- of any size
begin
Put_Line("Enter Number Of Elements Of Array");
Get(n);
declare -- now we know the size
My_Arr : Arr(1 .. n);
begin -- My_Arr is in scope until the end of this block
...
end;
end sort;
Using the type system better...
Bad programming :
for i in 1 .. n loop
Get(MyArr(i));
end loop;
HeapSort(MyArr,n);
for i in 1 .. n loop
Put_Line(Integer'Image(MyArr(i)));
end loop;
This is bad because it violates the DRY principle : loop bounds repeated, and something that hopefully represents the array size passed around as a separate parameter... a maintenance nightmare if you decide to rename n to something meaningful for example.
better programming : Use the type system. Recognise that merely declaring an array has declared a new subtype of integer, representing the index of the array. You can access it as My_Arr'range, and the high bound as My_Arr'last.
for i in My_Arr'range loop
Get(MyArr(i));
end loop;
HeapSort(MyArr);
for i in My_Arr'range loop
Put_Line(Integer'Image(MyArr(i)));
end loop;
And accidents such as redefining n after the array declaration can no longer generate buffer overflows.
NOTE: Heapsort now gets its range from the array. (Max_Heapify may still need a separate parameter to operate on subsets of the array)
Arguably best - if it makes the intent clearer - name the index datatype explicitly and use it...
declare -- now we know the size
subtype My_Range is positive range 1 .. n;
My_Arr : Arr(My_Range);
begin -- My_Arr is in scope until the end of this block
for i in My_Range loop ...
And lastly, which do you prefer; a Storage_Error exception immediately the bug occurs (writing to memory you forgot to allocate) or something odd happening much later because something scribbled across another variable?
EDIT
Having cleared up the major issues two more subtle ones remain...
If I compile the modified program (in Gnat 4.8) I get several warnings : one of them is important and tells you exactly what the problem is...
Most of the warnings stem from the fact that
for i in My_Arr'range loop
declares its own loop variable i which hides any existing in-scope declaration. So you can tidy up the code by removing the unnecessary declarations.
What remains is:
sort.adb:51:28: warning: loop range may be null
sort.adb:51:28: warning: bounds may be wrong way round
The for loop bounds are empty ranges, reversed...
1 .. 3 declares a subtype with 3 values
reverse 1 .. 3 declares the same subtype and iterates backwards over it.
But 3 .. 1 declares an EMPTY subtype (containing NO valid values) so iterating over it - either way round - does precisely nothing.
Hopefully that is the missing part of the puzzle. I'm not clear why one faulty loop gets this warning while the other (at line 38) doesn't...
if j<n **and then** Int_Acc(j+1)>Int_Acc(j) then
j:=j+1;
I think you want just 'and' instead of 'and then,' although I haven't looked at Ada code in years.
Did that compile?
I am new with Ada programming. I am trying to generate a 80 column and 40 rows table, each case is randomly filled with either M or V. Any help with how to create this kind of table would be much appreciated !
Here's what I have so far for the table in .ads :
package Life is
type Grid is (mort, vivant);
type TableauCell is array ( 0..80, 0..40 ) of Grid;
procedure Grid_Random_Fill(A : in out Grid);
end Life;
and the randomization:
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Numerics.Discrete_Random ;
use Ada.Text_IO, Ada.Integer_Text_IO;
package body Life is
procedure Grid_Random_Fill is
type Life is (V, M);
package Random_Life is new Ada.Numerics.Discrete_Random (Life) ;
use Random_Life ;
G : Generator ;
begin
Reset (G) ; -- intialise the generator
loop
Case Random(G) is
when V =>
put("V"); -- put V in table
when M =>
put("M"); -- put M in table
end case;
end loop ;
end Grid_Random_Fill;
end life;
Unfortunately I can't get it to compile - and I don't see how I can automatically generate M and V into my table. I'm not sure I was clear, I'm all new to coding.
This sounds homeworkish, so this is going to be kept somewhat abstract.
Declare a two-element type to represent M and V.
Declare an 80x40 array of that type.
Instantiate Ada.Numerics.Discrete_Random with that type.
Iterate over the array bounds, setting each array element via a call to the random number package's Random() function.
Since this has the feel of homework, how about an overly-complex, overly-generalized example?
Everything works, except the randomization, which is an exercise left to the reader.
Test_Table.adb
With
Tabling,
Ada.Streams.Stream_IO,
Ada.Text_IO.Text_Streams;
Use
Ada.Text_IO;
Procedure Test_Table is
-- Here we declare a stream and associate it with the standard-output,
-- this can easily be altered to any file. Yay streams!
Output : Access Ada.Streams.Root_Stream_Type:=
Ada.Text_IO.Text_Streams.Stream( Standard_Output );
Package test is new Tabling( Rows => 40, Cols => 80 );
temp : test.Table;
Begin
-- A single line to write the table.
Test.Table'Write( Output, temp );
New_Line;
End Test_Tables;
Now isn't that nice and simple? Well, here's the over-complex & over-generalized part: the specification and implementation!
Tabling.ads
Pragma Ada_2012;
With Ada.Streams;
Generic
Rows : Positive := 3;
Cols : Positive := 4;
Package Tabling is
-- Tables with rows or columns exceeding 200 are absurd, so we disallow them.
Maximum : constant:= 200;
Pragma Assert (Rows <= Maximum and Cols <= Maximum);
-- Table is a private entity.
Type Table is private;
-- Forward declaring the rows and columns here.
Type Col is private;
Type Row is private;
Private
Use Ada.Streams;
-- We are defining a type with elements of 'V' or 'M'.
Type Element_Type is ( 'M', 'V' );
-- We are declaring a stream writing function.
Procedure Write(
Stream : access Root_Stream_Type'Class;
Item : in Element_Type);
-- We are overriding the default write function with the one we defined.
For Element_Type'Write use Write;
-- Because we don't want an allocation wrror we restrict index-ranges to
-- a more reasonable value.
SubType Short_Positive is Positive Range Positive'First..Maximum;
-- We create subtypes representing the ranges that Rows or Columns take.
subtype column_index is Short_Positive Range Positive'First..Cols;
subtype row_index is Short_Positive Range Positive'First..Rows;
-- Here we define stream-writing functions for rows and columns.
Procedure Write(
Stream : access Root_Stream_Type'Class;
Item : in Col);
Procedure Write(
Stream : access Root_Stream_Type'Class;
Item : in Row);
-- Here we override the stream-writing methods for rows and columns.
For Col'Write Use Write;
For Row'Write Use Write;
-- Here we finally define Rows and Columns.
Type Col is Array(column_index)of Element_Type;
Type Row is Array( row_index ) of Col;
-- THIS IS A STUB, SUBSTITUTED FOR YOUR CALL TO RANDOM.
Function RANDOM_CALL Return Element_Type is ( 'M' );
-- Finally we define the stream-writing for a table...
Procedure Write(
Stream : access Root_Stream_Type'Class;
Item : in Table);
-- and define what a table is...
Type Table is record
Data : Row:= ( others => (others => RANDOM_CALL) );
end record;
-- finishing off by assigning our write function to the type.
For Table'Write Use Write;
End Tabling;
Tabling.adb
package body Tabling is
-- Quick definition of the new-line, windows-style.
New_Line : Constant String:= ASCII.CR & ASCII.LF;
-- Implementations of our stream writing functions.
Procedure Write(
Stream : access Root_Stream_Type'Class;
Item : in Element_Type) is
-- Convert takes the element-type and transforms it into a character.
Function Convert (Input : Element_Type:= Item) Return Character is
begin
-- A simple mapping using case, it also has the advantage of raising
-- a compiler error should the valuse "Element_Type" can take change.
case Input is
when 'M' => return 'm';
when 'V' => return 'v';
end case;
end Convert;
begin
Character'Write( Stream, Convert );
end Write;
Procedure Write(
Stream : access Root_Stream_Type'Class;
Item : in Col) is
begin
-- Using the new-style for-loop, we iterate over the given columns,
-- taking care to wrap the elements in the table's cell-definition tag.
for Element of Item loop
String'Write( Stream, ASCII.HT & "<td>" );
Element_Type'Write( Stream, Element );
String'Write( Stream, "</td>" & New_Line );
end loop;
end Write;
Procedure Write(
Stream : access Root_Stream_Type'Class;
Item : in Row) is
begin
-- Using the new-style loop, we iterate through the row, wrapping each
-- in the table-row tag, <tr>.
for Element of Item loop
String'Write( Stream, "<tr>" & New_Line);
col'Write( Stream, Element );
String'Write( Stream, "</tr>" & New_Line);
end loop;
end Write;
Procedure Write(
Stream : access Root_Stream_Type'Class;
Item : in Table) is
begin
-- Start the table.
String'Write(Stream, "<Table>" & New_Line);
-- Write out the rows.
Row'Write (Stream, Item.Data );
-- End the table.
String'Write(Stream, "</Table>");
end Write;
End Tabling;
The procedure body for Grid_Random_Fill needs to agree with the specification, which is:
procedure Grid_Random_Fill(A : in out Grid);
The body does not include the parameter A.
The solution will involve two nested loops, over the range of the two dimensions in the array you declared.
And the simple answer :
with Ada.Numerics.Discrete_Random;
with Ada.Text_Io;
procedure Main is
type Cell_T is (M,V);
type Rows_T is new Integer Range 1 .. 40;
type Cols_T is new Integer Range 1 .. 80;
type Grid_T is array (Rows_T,Cols_T) of Cell_T;
package Rand is new Ada.Numerics.Discrete_Random (Cell_T);
G : Rand.Generator;
Grid : constant Grid_T := (others => (others => Rand.Random(G)));
begin
for R in Rows_T'range loop
for C in Cols_T'range loop
Ada.Text_Io.Put (Cell_T'Image (Grid (R,C)));
end loop;
Ada.Text_Io.New_Line;
end loop;
end Main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