[Gambas-user] R: how to generation 12 random letters (A-Z and 0-9)

Gianluigi bagonergi at ...626...
Fri Jun 5 15:08:27 CEST 2015


Hello Fernando,
Since version 3.6 you can use Rand that returns an integer, contrary to
Rnd, the higher born of the interval can be returned.
Rand(1, 36), 1)

Hello all,
kindly you can let me know if this email appears as a SPAM

Regards
Gianluigi

2015-06-05 11:07 GMT+02:00 Ru Vuott <vuott at ...325...>:

> ...or similarly by using String[] array:
>
> Public Sub Main()
>
> Dim b As Byte
> Dim ss As String[] = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
>                       "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
> "U", "V", "W", "X", "Y", "Z",
>                       "1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
> Null]
>
>   For b = 1 To 12
>     ss[ss.Max] &= ss[Rnd(0, 36)]
>   Next
>
>   Print ss[ss.Max]
>
> End
>
>
>
>
> --------------------------------------------
> Ven 5/6/15, nando <nando_f at ...951...> ha scritto:
>
>  Oggetto: Re: [Gambas-user] R: how to generation 12 random letters (A-Z
> and     0-9)
>  A: "mailing list for gambas users" <gambas-user at lists.sourceforge.net>
>  Data: Venerdì 5 giugno 2015, 02:55
>
>  Thanks folks,
>  Not being pickey at all!!
>  I
>  made two mistakes..
>  (That is why open source
>  is better than closed source)
>  Corrections
>  made:
>
>  Dim j as Byte
>  Dim s as String
>
>  For j = 1 To 12
>      s &=
>  Mid("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
>  Int(Rnd((1, 37)), 1)
>  Next
>
>  Print s
>
>  :)
>  -Fernando
>
>  ---------- Original Message
>  -----------
>  From: Fabien Bodard <gambas.fr at ...626...>
>  To: mailing list for gambas users <gambas-user at lists.sourceforge.net>
>  Sent: Wed, 3 Jun 2015 15:14:45 +0200
>  Subject: Re: [Gambas-user] R: how to generation
>  12 random letters (A-Z and 0-9)
>
>  > Chr(Rand(48,90))
>  >
>  > 2015-06-02 15:28 GMT+02:00 Paul Horechuk
>  <phorechuk at ...626...>:
>  > > Just being a bit picky here, but
>  shouldn't that be Rnd(1,36) ? 26
>  >
>  > letters and 10 digits?
>  > >
>  > > On 15-06-02 08:49 AM, nando wrote:
>  > >> Alternate:
>  >
>  >>
>  > >> Dim j as Byte
>  > >> Dim s as String
>  > >>
>  > >> For
>  j = 1 To 12
>  > >>    s &=
>  Mid("ABCDEFGJIJKLMOPQRSTUVWXYZ0123456789", Int(1,
>  13), 1)
>  > >> Next
>  > >>
>  > >>
>  Print s
>  > >>
>  >
>  >>
>  > >> ---------- Original
>  Message -----------
>  > >> From:
>  Jussi Lahtinen <jussi.lahtinen at ...626...>
>  > >> To: mailing list for gambas users
>  <gambas-user at lists.sourceforge.net>
>  > >> Sent: Sat, 30 May 2015 17:41:43
>  +0300
>  > >> Subject: Re:
>  [Gambas-user] R: how to generation 12 random letters (A-Z
>  and 0-9)
>  > >>
>  >
>  >>> You can write that in nicer way with rand()
>  function, than rnd() function.
>  >
>  >>> But that doesn't really matter, your code
>  works anyway.
>  > >>>
>  > >>> Jussi
>  >
>  >>>
>  > >>> On Sat, May
>  30, 2015 at 3:12 PM, Ru Vuott <vuott at ...325...>
>  wrote:
>  > >>>
>  > >>>> Hello,
>  > >>>>
>  >
>  >>>> I propose:
>  >
>  >>>>
>  > >>>>
>  > >>>> Public Sub
>  Button1_Click()
>  > >>>>
>  > >>>>    Dim j As Byte
>  > >>>>    Dim s As String
>  > >>>>
>  >
>  >>>>    For j = 1 To 12
>  >
>  >>>>      If Fix(Rnd(0, 2)) Then
>  > >>>>        s &=
>  Chr(Rnd(48, 58))
>  > >>>>
>    Else
>  > >>>>        s
>  &= Chr(Rnd(65, 91))
>  >
>  >>>>      Endif
>  >
>  >>>>    Next
>  >
>  >>>>
>  > >>>>
>  Print s
>  > >>>>
>  > >>>> End
>  >
>  >>>>
>  > >>>>
>  > >>>>
>  --------------------------------------------
>  > >>>> Sab 30/5/15, tsukuba GIMP
>  user <tsukubagraduates at ...3482...>
>  ha scritto:
>  > >>>>
>  > >>>>   Oggetto:
>  [Gambas-user] how to generation 12 random letters (A-Z and
>  0-9)
>  > >>>>   A:
>  "gambas-user" <gambas-user at lists.sourceforge.net>
>  > >>>>   Data: Sabato
>  30 maggio 2015, 11:16
>  >
>  >>>>
>  >
>  >>>>   i want when i click button
>  (button_1)
>  >
>  >>>>   LCDpanl(LCDLabel1) will be
>  Generation 12 random letters
>  >
>  >>>>   how to
>  [UTF-8?][UTF-8?]do?
>  >
>  >>>>
>  >
>
>  >>>>   ------------------------------------------------------------------------------
>  >
>  >>>>   _______________________________________________
>  > >>>>   Gambas-user
>  mailing list
>  >
>  >>>>   Gambas-user at lists.sourceforge.net
>  > >>>>   https://lists.sourceforge.net/lists/listinfo/gambas-user
>  > >>>>
>  >
>  >>>>
>  > >>>>
>  > >>>>
>
>  ------------------------------------------------------------------------------
>  > >>>>
>  _______________________________________________
>  > >>>> Gambas-user mailing
>  list
>  > >>>> Gambas-user at lists.sourceforge.net
>  > >>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>  > >>>>
>  >
>  >>>
>
>  ------------------------------------------------------------------------------
>  > >>>
>  _______________________________________________
>  > >>> Gambas-user mailing list
>  > >>> Gambas-user at lists.sourceforge.net
>  > >>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>  > >> ------- End of Original Message
>  -------
>  > >>
>  >
>  >>
>  > >>
>
>  ------------------------------------------------------------------------------
>  > >>
>  _______________________________________________
>  > >> Gambas-user mailing list
>  > >> Gambas-user at lists.sourceforge.net
>  > >> https://lists.sourceforge.net/lists/listinfo/gambas-user
>  > >
>  > > --
>  > > Think Free ...
>  >
>  >     Use Open Source Software
>  > >
>  > >
>  > >
>
>  ------------------------------------------------------------------------------
>  > >
>  _______________________________________________
>  > > Gambas-user mailing list
>  > > Gambas-user at lists.sourceforge.net
>  > > https://lists.sourceforge.net/lists/listinfo/gambas-user
>  >
>  > --
>  > Fabien Bodard
>  >
>  >
>
>  ------------------------------------------------------------------------------
>  >
>  _______________________________________________
>  > Gambas-user mailing list
>  > Gambas-user at lists.sourceforge.net
>  > https://lists.sourceforge.net/lists/listinfo/gambas-user
>  ------- End of Original Message -------
>
>
>
>  ------------------------------------------------------------------------------
>  _______________________________________________
>  Gambas-user mailing list
>  Gambas-user at lists.sourceforge.net
>  https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
Regards
Gianluigi



More information about the User mailing list