I use ns3::UniformRandomVariable to generate random OffTimes from an uniform distribution in an OnOff application. I use the OnOffHelper to setup my OnOff application.
OnOffHelper server ("ns3::TcpSocketFactory", (InetSocketAddress (apInterface.GetAddress(0), 9)));
server.SetAttribute ("PacketSize", UintegerValue (512));
server.SetAttribute ("OnTime", StringValue("ns3::ConstantRandomVariable[Constant=10]"));
server.SetAttribute ("OffTime", StringValue ("ns3::UniformRandomVariable[Min=0|Max=5]"));
server.SetAttribute ("DataRate", DataRateValue (DataRate ("100Mbps")));
ApplicationContainer serverApp = server.Install(staWifiNode);
However, I don't see a way to get the current OffTime when running the simulation. Is there a convenient way to get track of the OffTimes?