Hi.

Thanks for all the suggestions. I ended up using this form as suggested by
Julius to create random numbers:

rand(x) = fn(x) / (RAND_MAX + 1)
with {
  fn = ffunction(int rand(float), <math.h>, "");
  RAND_MAX = fconstant(int RAND_MAX, <math.h>);
};

It has the benefit that I can control via the input stream what kind of
random stream I want out.

With a constant in I get a constant out, with parameters in I get block
level randoms out (haven't tested this actually) and with a sample stream I
get random samples out.

Also as it is now a really pure function, it should be easier to optimize.

Timo





On Sat, Apr 26, 2014 at 11:38 AM, Kjetil Matheussen <
[email protected]> wrote:

>
>
>
> On Thu, Apr 24, 2014 at 10:23 PM, Julius Smith <[email protected]>wrote:
>
>>  Maybe it should be possible declare "volatile" foreign functions that
>> are not optimized in this way?
>>
>>
> What about calling it "detach", which kind of works the opposite way of
> "attach":
>
> rand = detach(fn(x)) / RAND_MAX
> with {
>   fn = ffunction(int rand(), <math.h>, "");
>   RAND_MAX = fconstant(int RAND_MAX, <math.h>);
> };
>
>
>
------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to