1
   

Help With Programming! (MATLAB specifically, others welcome!

 
 
Quincy
 
Reply Wed 16 May, 2007 06:28 am
I need to generate a random integer number between 3 and 79 with equal probability. I know how to get such a number between (inclusive) 1 and 79, but I cant generate the numbers so that they will always be greater than 3. I can do this with a if loop, but this is laborious, and when the number is less that 3 it is set to 0. Any help?
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 594 • Replies: 2
No top replies

 
parados
 
  1  
Reply Wed 16 May, 2007 06:53 am
If you can generate 1-79 then you can probably generate 1-77.

Simply generate a random number between 1 and 77 and add 2 to it.
0 Replies
 
Quincy
 
  1  
Reply Wed 16 May, 2007 07:25 am
Genius! Oh my goodness, that is fantastic! Thank you so very much parados! (I feel silly for not noticing that...) I may have more questions, so keep checking back here regularly, please! I could use your brilliant logic...
0 Replies
 
 

Related Topics

Clone of Micosoft Office - Question by Advocate
Do You Turn Off Your Computer at Night? - Discussion by Phoenix32890
The "Death" of the Computer Mouse - Discussion by Phoenix32890
Windows 10... - Discussion by Region Philbis
Surface Pro 3: What do you think? - Question by neologist
Windows 8 tips thread - Discussion by Wilso
GOOGLE CHROME - Question by Setanta
.Net and Firefox... - Discussion by gungasnake
Hacking a computer and remote access - Discussion by trying2learn
 
  1. Forums
  2. » Help With Programming! (MATLAB specifically, others welcome!
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 04/27/2024 at 04:31:54