# I'm trying to create an array of handles for a class, by randomize function I'll get the "no of transcations", this determines the no of handles to be created.class\_name obj\_name\[transactions\]; is this right?

**URL:** <https://verificationacademy.com/forums/t/im-trying-to-create-an-array-of-handles-for-a-class-by-randomize-function-ill-get-the-no-of-transcations-this-determines-the-no-of-handles-to-be-created-class-name-obj-name-transactions-is-this-right/31031>\
**Category:** SystemVerilog\
**Tags:** SystemVerilog, class-handle\
**Created:** [September 15, 2015, 5:10pm UTC](https://verificationacademy.com/forums/t/im-trying-to-create-an-array-of-handles-for-a-class-by-randomize-function-ill-get-the-no-of-transcations-this-determines-the-no-of-handles-to-be-created-class-name-obj-name-transactions-is-this-right/31031 "2015-09-15T17:10:39Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![bmorris](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/bmorris/32/2097_2.png) [@bmorris](https://verificationacademy.com/forums/u/bmorris)\
**Post date:** [September 15, 2015, 8:26pm UTC](https://verificationacademy.com/forums/t/im-trying-to-create-an-array-of-handles-for-a-class-by-randomize-function-ill-get-the-no-of-transcations-this-determines-the-no-of-handles-to-be-created-class-name-obj-name-transactions-is-this-right/31031/7 "2015-09-15T20:26:45Z")

</div>

_In reply to [Ammu4392](https://verificationacademy.com/forums/t/im-trying-to-create-an-array-of-handles-for-a-class-by-randomize-function-ill-get-the-no-of-transcations-this-determines-the-no-of-handles-to-be-created-class-name-obj-name-transactions-is-this-right/31031/6):_

I’d use foreach for an array, but you can use both.

foreach (obj[i]) begin  
…  
end

---

_[View the full topic](https://verificationacademy.com/forums/t/im-trying-to-create-an-array-of-handles-for-a-class-by-randomize-function-ill-get-the-no-of-transcations-this-determines-the-no-of-handles-to-be-created-class-name-obj-name-transactions-is-this-right/31031)._
