Click here to Skip to main content
16,017,788 members
Home / Discussions / C#
   

C#

 
GeneralRe: Avoiding Random() Class generate the same number Pin
gamer112719-Aug-09 3:45
gamer112719-Aug-09 3:45 
GeneralRe: Avoiding Random() Class generate the same number Pin
Dave Kreskowiak19-Aug-09 4:00
mveDave Kreskowiak19-Aug-09 4:00 
AnswerRe: Avoiding Random() Class generate the same number Pin
Eddy Vluggen19-Aug-09 3:26
professionalEddy Vluggen19-Aug-09 3:26 
AnswerRe: Avoiding Random() Class generate the same number Pin
gamer112719-Aug-09 4:13
gamer112719-Aug-09 4:13 
GeneralRe: Avoiding Random() Class generate the same number Pin
PIEBALDconsult19-Aug-09 4:29
mvePIEBALDconsult19-Aug-09 4:29 
GeneralRe: Avoiding Random() Class generate the same number Pin
gamer112719-Aug-09 4:34
gamer112719-Aug-09 4:34 
GeneralRe: Avoiding Random() Class generate the same number Pin
PIEBALDconsult19-Aug-09 7:16
mvePIEBALDconsult19-Aug-09 7:16 
GeneralRe: Avoiding Random() Class generate the same number Pin
Keith Barrow19-Aug-09 4:33
professionalKeith Barrow19-Aug-09 4:33 
Given you are writing a lottery number generater, there is an easier implmenation to select numbers:

1. Create a list of int, containing the numbers in order you want to select from (e.g. 1-50)
2. Create a random position number (starting in the range 0-49 in my example),
3. Take the value at the random position and remove from the list
4. Reduce the random position range by one as you have removed from the source list
5. Rinse and repeat steps 3 & 4 until you have enough numbers to fill your lottery card...
You can refactor this to work without the list, but it will be harder to understand
GeneralRe: Avoiding Random() Class generate the same number Pin
PIEBALDconsult19-Aug-09 7:17
mvePIEBALDconsult19-Aug-09 7:17 
GeneralRe: Avoiding Random() Class generate the same number Pin
Eddy Vluggen19-Aug-09 4:35
professionalEddy Vluggen19-Aug-09 4:35 
GeneralRe: Avoiding Random() Class generate the same number Pin
Saksida Bojan19-Aug-09 5:49
Saksida Bojan19-Aug-09 5:49 
AnswerRe: Avoiding Random() Class generate the same number Pin
PIEBALDconsult19-Aug-09 7:45
mvePIEBALDconsult19-Aug-09 7:45 
QuestionWhy \r\n? Pin
hairy_hats19-Aug-09 3:00
hairy_hats19-Aug-09 3:00 
AnswerRe: Why \r\n? Pin
Keith Barrow19-Aug-09 3:09
professionalKeith Barrow19-Aug-09 3:09 
GeneralRe: Why \r\n? Pin
hairy_hats19-Aug-09 3:14
hairy_hats19-Aug-09 3:14 
GeneralRe: Why \r\n? Pin
Eddy Vluggen19-Aug-09 3:21
professionalEddy Vluggen19-Aug-09 3:21 
GeneralRe: Why \r\n? Pin
hairy_hats19-Aug-09 3:47
hairy_hats19-Aug-09 3:47 
GeneralRe: Why \r\n? Pin
Dan Neely19-Aug-09 4:33
Dan Neely19-Aug-09 4:33 
AnswerRe: Why \r\n? Pin
PIEBALDconsult19-Aug-09 4:51
mvePIEBALDconsult19-Aug-09 4:51 
AnswerRe: Why \r\n? Pin
Vikram A Punathambekar19-Aug-09 7:13
Vikram A Punathambekar19-Aug-09 7:13 
GeneralRe: Why \r\n? Pin
hairy_hats19-Aug-09 8:17
hairy_hats19-Aug-09 8:17 
GeneralRe: Why \r\n? Pin
PIEBALDconsult19-Aug-09 18:20
mvePIEBALDconsult19-Aug-09 18:20 
QuestionListBox - drag to organize Pin
transmitable19-Aug-09 2:55
transmitable19-Aug-09 2:55 
AnswerRe: ListBox - drag to organize Pin
Saksida Bojan19-Aug-09 6:24
Saksida Bojan19-Aug-09 6:24 
Questioncoloring the row after pressing a button Pin
salemmohamed19-Aug-09 2:23
salemmohamed19-Aug-09 2:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.