# Random Custom Classes

**URL:** <https://discourse.processing.org/t/random-custom-classes/15354>\
**Category:** Coding Questions\
**Created:** [November 9, 2019, 4:04pm UTC](https://discourse.processing.org/t/random-custom-classes/15354 "2019-11-09T16:04:21Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [November 9, 2019, 5:21pm UTC](https://discourse.processing.org/t/random-custom-classes/15354/5 "2019-11-09T17:21:15Z")

</div>

True.

and then

```auto
void keyPressed() {
if(key=='f') {
    makeNewFish();
}
}

void makeNewFish() {
int kind=int(random(4)); 
Fish newFish; 
switch(kind){
case 0:
newFish=new Betta(betta, "Sally", 250, 250, 2);
break; 

case 1: 
newFish= new Gourami(gourami, "George", 250, 250, 4);
break; 

//....

}//switch 

fishes.add(newFish); 
}

```

use more random numbers for size, position and speed please

---

_[View the full topic](https://discourse.processing.org/t/random-custom-classes/15354)._
