RNG in C-external instances

11OLSEN's icon

hallo, i'm trying to generate a different random number in different instances of an external. can you give me some advise

i'm using the normal rand(). Is the sdk offering something else/better?

the number is generated at object initialization. could it happen, if i use time as seed, that two instances generate the same number because initialization of both objects happens faster than 1ms?? if so, what can give me faster seeds?

Thanbks O.

11OLSEN's icon

hey, not sure if i get what you mean. "class is loaded once"?
i'm using the "new" function to generate the number. it doesn't matter where i seed it. Interessting for me is what happens if i load a patch with two instances of the ext, how can i make sure both instances are generating a different random number when they are created.
with different seeds, right? how do i get different seeds so fast?

i don't want to do intance to instance messages for this simple task.

tell me if it's still hard to understand my question.
O.

11OLSEN's icon

do you mean main() is only called once even if a second and third instance is created? so that rand_s in instance 2 will create random number 2 of the seed? i'll try that out.
thanks for your help so far..

11OLSEN's icon

cool, it works. and learned something..
thanks, bye