Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Please Help- Newbie

GavlesterGavlester Member Posts: 1
[b][red]This message was edited by Gavlester at 2002-9-20 4:6:42[/red][/b][hr]
Howdy all. I have only just started coding and basically what i need is a way to create 8 different RANDOM numbers without a number being repeated.

I am able to create the Random numbers (Simple enough) but i cannot make it so that the numbers aren't repeated.

Your help would be most appreciated.

Can you please send any assistance to lester@spalf.com


Comments

  • ZantosZantos Member Posts: 139
    Alright, I can help...

    Dim x(1 To 8)
    Dim n, b

    For n = 1 to 8
    Retry:
    Randomize Timer
    x(n) = Int(Rnd * 100) + 1
    For b = 8 to 1 Step -1
    If x(n) = x(b) Then Goto Retry
    Next b
    Next n

    Don't complain if it doesn't work, I just thought of that off the top of my head, but it should work, and if it doesn't, then it gives you grounds for how to do it. If you really do need me to do it, then e-mail me at JLogix@Hotmail.com and I'll make a program and write out the source code which will tell you how to do it.

    ..:: Zantos ::..
  • Chris BrownChris Brown USAMember Posts: 4,496 ✭✭

    _____ < http://forcoder.org /> free video tutorials and ebooks about || PL/SQL MATLAB C++ Visual Basic Python Go C# R Visual Basic .NET Objective-C Perl Java C Ruby PHP Assembly Swift Scratch Delphi JavaScript Logo Prolog Lisp Lua Ada ABAP Transact-SQL LabVIEW F# Bash SAS Kotlin Fortran VBScript Clojure Awk Dart Rust ML FoxPro Scala Hack Apex Crystal COBOL Alice Erlang D Scheme Julia || ____

Sign In or Register to comment.