electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
go to the radio page Live at electro-music.com radio 1 Please visit the chat
  host / artist show at your time
today> Twyndyllyngs Live Chez Mosc
 Forum index » DIY Hardware and Software » Developers' Corner
triangular distribution
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 1 [4 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
bachus



Joined: Feb 29, 2004
Posts: 2922
Location: Up in that tree over there.
Audio files: 5

PostPosted: Sun Sep 18, 2005 2:03 pm    Post subject: triangular distribution Reply with quote  Mark this post and the followings unread

I needed a triangular distribution random number generator the other day and went looking for source code on the net and eventually came up with this:

http://peabody.sapp.org/class/dmp2/lab/whitenoise/

The code for the generalized triangular distribution random number generator was very buggy and didn’t produce anything like a triangular distribution. I’ve emailed the author to that effect, and perhaps he’ll fix it.

Anyway I fixed and rewrote it and added an integer form and an acuity parameter and added them to my random number generator class. I’ve attached the files for that class for any one to use. (I haven’t tested the __int64 form, h(), yet so it may not work)

The only disadvantage is that there is no way to provide independent streams because of the way the state vector of the Mersenne Twister Random Number Generator was implemented by Jasper Bedaux—see the header file credits. I will fix that eventually. BTW this compiles and runs under VC++6.0

If some kind soul has the code for an integer version of a generalized gaussian distribution and would like to share that I would be very grateful.


Stochast.h
 Description:

Download (listen)
 Filename:  Stochast.h
 Filesize:  8.77 KB
 Downloaded:  519 Time(s)


Stochast.cpp
 Description:

Download (listen)
 Filename:  Stochast.cpp
 Filesize:  10.52 KB
 Downloaded:  499 Time(s)


_________________
The question is not whether they can talk or reason, but whether they can suffer. -- Jeremy Bentham
Back to top
View user's profile Send private message Visit poster's website
jksuperstar



Joined: Aug 20, 2004
Posts: 2503
Location: Denver
Audio files: 1
G2 patch files: 18

PostPosted: Sun Sep 18, 2005 3:05 pm    Post subject: Reply with quote  Mark this post and the followings unread

GNU has a library for this, you might get a lot of use out of it, if your looking for lots of types of random variables. I think it is randist.h or similar.

(after googling) This is what I was thinking about:
http://www.gnu.org/software/gsl/

The GNU Scientific Library. Since it's open-source, you could grab any parts of it for your own use.
Back to top
View user's profile Send private message Visit poster's website
ian-s



Joined: Apr 01, 2004
Posts: 2672
Location: Auckland, New Zealand
Audio files: 42
G2 patch files: 626

PostPosted: Sun Sep 18, 2005 3:47 pm    Post subject: Reply with quote  Mark this post and the followings unread

CMATH.C from the csound source has lots of random gens
Back to top
View user's profile Send private message
bachus



Joined: Feb 29, 2004
Posts: 2922
Location: Up in that tree over there.
Audio files: 5

PostPosted: Sun Sep 18, 2005 5:44 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks for the tips.

I had actually started out searching the GSL for the triangular distribution and did not find it there. I just checked again to see if I had missed it and I still don’t find it. But stix is not exactly a strong point for me so perhaps it goes by a more esoteric name? (GSL is eat up with distributions I never heard of.) Anyone know?

Anyway the GSL is indeed an excellent source and I wish I had known about it before I had started the Stochast class.

As for the gaussian what I need is a function that has the same call format as the triangular. I.e. it would look like:

int Stoch::iGaussian(int lower, int max, int upper, double acuity)

So far I haven’t found anything like it so I may eventually have to dig out the math books and see if I can figure out how to get there from the standard implementations ..ho-hum. But I keep hoping it will just fall into my lap.

Haven’t dug through the Csound math library yet, will try that before I give up.

Again thanks.

_________________
The question is not whether they can talk or reason, but whether they can suffer. -- Jeremy Bentham
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 1 [4 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Developers' Corner
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use