But what is the meaning of using the size of an associative array as a constraint? Shalom > -----Original Message----- > From: Arturo Salz > Sent: Wednesday, May 17, 2006 10:05 AM > > The intent was to allow randomizing an array's contents, not the > indices. In that case, an associative array of integral values could be > treated in much the same way as a dynamic array, that is, it's indices > would indeed be in the range 0..N (not sparse) and its elements would be > randomized. Note that one can accomplish the effect of randomized (and > sparse) indices by creating two dynamic arrays, one of indices and one > of values, and then use the post_randomize method to collect both of > these into an associative array. > > Arturo > > -----Original Message----- > From: Gordon Vreugdenhil > Sent: Tuesday, May 16, 2006 10:23 PM > > I don't think that it makes sense to create entries in an > associative array as 13.4.7 suggests. For dynamic arrays, > the indices are constrained to the range 0..N so just > specifying a size is sufficient. I think that if you want > a randomly sized and/or randomly indexed associative array > that you need to first construct the "shape" and then > randomize the elements. > > Gord. > > Ryan, Ray wrote: > > > In the section 13.3 where random variable are discussed, the LRM > state: > > "The size of a dynamic array declared as rand or randc can also be > > constrained. In that case, the array shall be resized according to the > > size constraint, and then all the array elements shall be randomized. > > ... " > > > >>From this my assumption would be that this resizing only applied to > > dynamic arrays > > and not associative arrays or queues. > > > > However in 13.4.7 (Iterative Constraints) there is the text: > > "The size method of a dynamic or associative array can be used to > > constrain the size of the array ... " > > > > This suggests that associative arrays are also re-sized by randomize. > > Is this the case? > > > > If so, what index values are used for the entries? There isn't any way > > to specify a constraint > > on the index value. Are all the existing entries first deleted? > > > > It seems the statement in 13.4.7 may be a typo (shouldn't have > mentioned > > associative arrays).Received on Wed May 17 02:34:51 2006
This archive was generated by hypermail 2.1.8 : Wed May 17 2006 - 02:36:02 PDT