Forums > Dev

RNG in C-external instances

March 2, 2012 | 4:44 pm

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.


March 2, 2012 | 5:48 pm

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.


March 2, 2012 | 6:19 pm

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..


March 2, 2012 | 7:39 pm

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


Viewing 4 posts - 1 through 4 (of 4 total)