- Jun 6, 2020
- 11,517
- 4,383
There are many code snippets on the forum for random numbers. This example is for a project Im doing that needs to randomly select 1 of 4 LED's. Im not too worried that its pseduo random but this code will get you a random number between 1 and 4 (but makes sure you dont get the same number twice in a row).
NOTE the upper limit is exclusive so for random numbers beween 1 and 4 we use 1 & 5. If you wanted a number between 2 and 6 you'd use 2 & 7.
NOTE the upper limit is exclusive so for random numbers beween 1 and 4 we use 1 & 5. If you wanted a number between 2 and 6 you'd use 2 & 7.
کد:
محتوای بلوک کدها در دسترس شما نیست. برای مشاهده بلوک کدها، وارد انجمن شوید یاثبت نام کنید
کد:
محتوای بلوک کدها در دسترس شما نیست. برای مشاهده بلوک کدها، وارد انجمن شوید یاثبت نام کنید
برای دیدن لینک ها باید ثبت نام کنید
برای دیدن لینک ها باید ثبت نام کنید