A new theory-independent noncontextuality inequality is presented [Phys. Rev. Lett. 115, 110403 (2015)] based on Kochen-Specker (KS) set without imposing the assumption of determinism. By proposing novel noncontextuality inequalities, we show that such result can be generalized from KS set to the noncontextuality inequalities not only for state-independent but also for state-dependent scenario. The YO-13 ray and $n$ cycle ray are considered as examples.