//random_stream_offset_ = 1000

begintemplate RandomStream
public r, repick, start, stream_id_1, stream_id_2, stream_id_3, random_stream_offset
//external random_stream_offset_
objref r
proc init() {
	stream_id_1 = $1
	stream_id_2 = $2
	stream_id_3 = $3
	random_stream_offset = $4
	r = new Random()
	start()
}
// to get same results on each run
// call rs.start() just before run()
func start() {
	//return r.MCellRan4(stream*random_stream_offset_ + 1)
	return r.Random123(stream_id_1*random_stream_offset + 1, stream_id_2, stream_id_3)
}
func repick() {
	return r.repick()
}
endtemplate RandomStream