Setting the global index with Random123

NMODL and the Channel Builder.
Post Reply
pascal
Posts: 106
Joined: Thu Apr 26, 2012 11:51 am

Setting the global index with Random123

Post by pascal »

A few years ago I went to the NEURON tutorial in La Jolla and received help writing a mod file which stimulated noisy synaptic events to a cell. It uses Random123, but there are no hoc calls to Random123--everything is done within the mod file. Within the INITIAL section, the two "identifier" seeds are set by calling setrand(gid,syn_index), which is defined at the bottom of the mod file:

Code: Select all

:this code uses Random123, which requires NEURON 7.3
:uses nrnran123.c and nrnran123.h from http://www.neuron.yale.edu/hg/neuron/nrn/file/9d4ab20927bc/src/oc/
VERBATIM
#define VOIDCAST void** vp = (void**)(&(_p_ptr))
extern void * nrnran123_newstream(int,int);
extern void nrnran123_deletestream(void *);
extern double nrnran123_dblpick(void *);
ENDVERBATIM

PROCEDURE setrand(id1,id2) {
	VERBATIM
	VOIDCAST;
	if(*vp) {
		nrnran123_deletestream(*vp);
	} 
	*vp = nrnran123_newstream((int) _lid1,(int) _lid2);
	ENDVERBATIM
} 

FUNCTION pick() {
	VERBATIM
	VOIDCAST;
	_lpick = nrnran123_dblpick(*vp);
	ENDVERBATIM
}
I recently realized that the global index for Random123 is never set in hoc, and so my simulation always produces the same output with every run. But I'm not sure how to set the global index, given that in my code Random123 is never invoked in hoc itself (as it is Michael Hines's post here: viewtopic.php?f=16&t=2494&p=9908&hilit=random123#p9908). I tried naively including the code

Code: Select all

objref r
r=new Random()
r.Random123_globalindex(1)
in my main hoc function, but it does not work. I still get identical results regardless of what value I pass to Random123_globalindex. Any help would be much appreciated. Thanks.
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Setting the global index with Random123

Post by ted »

To help you with this, I'll have to see your mod file and a small hoc test file that illustrates its usage. Can you zip those up and email them to ted dot carnevale at yale dot edu?
Post Reply