Reply To: Negative weights and index range in DistInt(weights)?
Why OSVVM™? › Forums › OSVVM › Negative weights and index range in DistInt(weights)? › Reply To: Negative weights and index range in DistInt(weights)?
I think if you use indices of ‘low & ‘high instead of ‘left & ‘right, and of ‘low + 1 instead of 1, then the direction of the supplied array will not matter. The actual left-right direction with which you build the DistArray is irrelevant, so long as you search it in the same direction.
You’re right, DistValInt() will let me do what I want, just not nearly as cleanly. DistValInt() is best for getting random members from a set of significantly non-contiguous integers, where an array with a big enough index range would be too big, and have lots of zero weights (even if it is easy to specify). A good example would be a set of prime numbers.
BTW, thank you very much for your work on this library!