Implement sample_state generator function up to first iteration