Predefined number of random results from every _type

Is it possible to get a predefined number of random results from every _type? For example when there are 5 types and the predefined number is 10, the final result will be 10 random results from each type resulting in a total of 50.

You can affect how documents get scored (randomly etc.). But you cannot change how many documents you get back. That you can control through the size parameter that you can provide with the search request:

GET /_search?size=30

you can also provide size as a top level field in the json request body.

So the logic depending on the number of types etc. should be moved to the client side I believe.