Random numbers without repitition

Why OSVVM?ForumsOSVVMRandom numbers without repitition

This topic has 3 voices, contains 3 replies, and was last updated by Avatar of Vijay Karthik Vijay Karthik 346 days ago.

Viewing 4 posts - 1 through 4 (of 4 total)
Author Posts
Author Posts
March 15, 2016 at 03:28 #1142
Avatar of Sebastian Dunst
Sebastian Dunst

Hello Jim, Hello community,

I ran into the requirement to generate a set of random numbers (k) out of range (n), but without repitition.

An example:
There is a system with 100 possible Tx Slots (1..100).
My FPGA is able to send data on 10 arbitrary (programmable) slots.
So in my testbench I would like to generate an integer_vector(1 to 10) with random numbers of range (1,100), but of course without repitition. Something like this:

 MyIntVec := MyRandVar.RandIntV(1,100,10,norep)

Is something like this possible with RandomPkg? I saw that there is the possibility to prohibit values, but I did not understand how to combine this with my issue.
Maybe one possible solution would be to throw the dices over and over again until there is no repition left inside the set of values. What do you think about that issue?

Thank you very much.
Regards,

Sebastian 

March 15, 2016 at 03:44 #1143
Avatar of Jim Lewis
Jim Lewis

Hi Sebastian

It should be, but check this in the user guide since I am on vacation

MyIntVect := MyRandVar.RandIntV (1,100,10,10);

The first 10 is the no-repeat distance.

Jim

  • This reply was modified 521 days ago by Avatar of Jim Lewis Jim Lewis. Reason: fixed repeated typing done by cell phone
March 15, 2016 at 04:16 #1144
Avatar of Sebastian Dunst
Sebastian Dunst

Hi Jim,

it seems that I have overlooked the “no-repeat” parameter.

Thank you very much.

Regards,
Sebastian

September 7, 2016 at 08:02 #1182
Avatar of Vijay Karthik
Vijay Karthik

*Hello, I am interested in doing a random verification check in my testbench and I am new to this. Can anyone help me to do this. I have an adder module (33 bit) and I need to add two random values (32 bit) and should store in this 33 bit register. help is appreciated. Thanks in advance

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.