Графический случайный генератор

В Linux вы можете редактировать .srt с помощью любого обычного текстового редактора. Если вы ищете что-то более профессиональное, Aegisub и Subtitle Composer. Ищите их в Центре программного обеспечения или используйте терминал:

sudo apt install subtitlecomposer aegisub -y

Дополнительно, проще:

sudo apt install gaupol gnome-subtitles subtitleeditor -y
10
задан 18 June 2012 в 23:05

19 ответов

ObsessiveFOSS попросил реализовать криптографически защищенный генератор псевдослучайных чисел Blum и др. . Вот мой эскиз о том, как это сделать. Другой код остается таким же, как в предыдущем ответе . Нужно просто заменить подпрограмму randomizeLabel и вставить этот код:

use bigint;

# Kinda large primes
$p = 338047573;   # Any pair of large primes will suffice here...
$q = 4182249941;  #+...as long as they fullfill the congruence check below
$rand = 7;    # Seed for the random number generator (x_0 in the wiki)

sub errMsg {
    $dialog = Gtk2::MessageDialog->new($window, 'destroy-with-parent', 'error', 'ok', $_[0]);
    $dialog->signal_connect (response => sub { exit 1; });
    $dialog->run;
}

# Check congruence 3 mod 4 (for quadratic residue)
if( ($p-3)%4 == 0 ) { errMsg('Error: Variable p is ill choosen.'); }
if( ($q-3)%4 == 0 ) { errMsg('Error: Variable q is ill choosen.'); }
# Note: For large cycle lengths gcd(φ(p-1), φ(q-1)) should also be small,...
#+...where φ is Euler's totient function but this is not checked here

# Compute Modulus in Blum Blum Shub
$M = $p*$q;

sub randomizeLabel { # This does the actual randomization
    $min = int($entry1->get_text); $max = int($entry2->get_text); # Boundaries for the desired random range from the input filed of the GUI (included for convenience when modifying the script - not used here)

    # Blum Blum Shub pseudo random number generator
    $rand = ($rand*$rand) % $M;

    # Here you have to extract the bits and shift them in range
    $randout = $rand & (2**6-1); # Change this line. It's an example and extracts the five least significant bits! To extract the ten LSBs use '(2**11-1)' and so on...
    # $randout = ...$min...$max...; # shift it in the right range (not done here)

    $diplabel->set_markup( "<span size=\"$size\">$randout</span>" );
}

Как уже упоминалось, он неполный. Нужно использовать побитовые операторы для извлечения полезных случайных чисел, сдвига и масштабирования их для соответствия между $min и $max. В настоящее время вход для минимума и максимума не используется.

36
ответ дан 25 July 2018 в 21:49

ObsessiveFOSS попросил реализовать криптографически защищенный генератор псевдослучайных чисел Blum и др. . Вот мой эскиз о том, как это сделать. Другой код остается таким же, как в предыдущем ответе . Нужно просто заменить подпрограмму randomizeLabel и вставить этот код:

use bigint;

# Kinda large primes
$p = 338047573;   # Any pair of large primes will suffice here...
$q = 4182249941;  #+...as long as they fullfill the congruence check below
$rand = 7;    # Seed for the random number generator (x_0 in the wiki)

sub errMsg {
    $dialog = Gtk2::MessageDialog->new($window, 'destroy-with-parent', 'error', 'ok', $_[0]);
    $dialog->signal_connect (response => sub { exit 1; });
    $dialog->run;
}

# Check congruence 3 mod 4 (for quadratic residue)
if( ($p-3)%4 == 0 ) { errMsg('Error: Variable p is ill choosen.'); }
if( ($q-3)%4 == 0 ) { errMsg('Error: Variable q is ill choosen.'); }
# Note: For large cycle lengths gcd(φ(p-1), φ(q-1)) should also be small,...
#+...where φ is Euler's totient function but this is not checked here

# Compute Modulus in Blum Blum Shub
$M = $p*$q;

sub randomizeLabel { # This does the actual randomization
    $min = int($entry1->get_text); $max = int($entry2->get_text); # Boundaries for the desired random range from the input filed of the GUI (included for convenience when modifying the script - not used here)

    # Blum Blum Shub pseudo random number generator
    $rand = ($rand*$rand) % $M;

    # Here you have to extract the bits and shift them in range
    $randout = $rand & (2**6-1); # Change this line. It's an example and extracts the five least significant bits! To extract the ten LSBs use '(2**11-1)' and so on...
    # $randout = ...$min...$max...; # shift it in the right range (not done here)

    $diplabel->set_markup( "<span size=\"$size\">$randout</span>" );
}

Как уже упоминалось, он неполный. Нужно использовать побитовые операторы для извлечения полезных случайных чисел, сдвига и масштабирования их для соответствия между $min и $max. В настоящее время вход для минимума и максимума не используется.

36
ответ дан 26 July 2018 в 17:01

ObsessiveFOSS попросил реализовать криптографически защищенный генератор псевдослучайных чисел Blum и др. . Вот мой эскиз о том, как это сделать. Другой код остается таким же, как в предыдущем ответе . Нужно просто заменить подпрограмму randomizeLabel и вставить этот код:

use bigint;

# Kinda large primes
$p = 338047573;   # Any pair of large primes will suffice here...
$q = 4182249941;  #+...as long as they fullfill the congruence check below
$rand = 7;    # Seed for the random number generator (x_0 in the wiki)

sub errMsg {
    $dialog = Gtk2::MessageDialog->new($window, 'destroy-with-parent', 'error', 'ok', $_[0]);
    $dialog->signal_connect (response => sub { exit 1; });
    $dialog->run;
}

# Check congruence 3 mod 4 (for quadratic residue)
if( ($p-3)%4 == 0 ) { errMsg('Error: Variable p is ill choosen.'); }
if( ($q-3)%4 == 0 ) { errMsg('Error: Variable q is ill choosen.'); }
# Note: For large cycle lengths gcd(φ(p-1), φ(q-1)) should also be small,...
#+...where φ is Euler's totient function but this is not checked here

# Compute Modulus in Blum Blum Shub
$M = $p*$q;

sub randomizeLabel { # This does the actual randomization
    $min = int($entry1->get_text); $max = int($entry2->get_text); # Boundaries for the desired random range from the input filed of the GUI (included for convenience when modifying the script - not used here)

    # Blum Blum Shub pseudo random number generator
    $rand = ($rand*$rand) % $M;

    # Here you have to extract the bits and shift them in range
    $randout = $rand & (2**6-1); # Change this line. It's an example and extracts the five least significant bits! To extract the ten LSBs use '(2**11-1)' and so on...
    # $randout = ...$min...$max...; # shift it in the right range (not done here)

    $diplabel->set_markup( "<span size=\"$size\">$randout</span>" );
}

Как уже упоминалось, он неполный. Нужно использовать побитовые операторы для извлечения полезных случайных чисел, сдвига и масштабирования их для соответствия между $min и $max. В настоящее время вход для минимума и максимума не используется.

36
ответ дан 31 July 2018 в 11:53

ObsessiveFOSS попросил реализовать криптографически защищенный генератор псевдослучайных чисел Blum и др. . Вот мой эскиз о том, как это сделать. Другой код остается таким же, как в предыдущем ответе . Нужно просто заменить подпрограмму randomizeLabel и вставить этот код:

use bigint;

# Kinda large primes
$p = 338047573;   # Any pair of large primes will suffice here...
$q = 4182249941;  #+...as long as they fullfill the congruence check below
$rand = 7;    # Seed for the random number generator (x_0 in the wiki)

sub errMsg {
    $dialog = Gtk2::MessageDialog->new($window, 'destroy-with-parent', 'error', 'ok', $_[0]);
    $dialog->signal_connect (response => sub { exit 1; });
    $dialog->run;
}

# Check congruence 3 mod 4 (for quadratic residue)
if( ($p-3)%4 == 0 ) { errMsg('Error: Variable p is ill choosen.'); }
if( ($q-3)%4 == 0 ) { errMsg('Error: Variable q is ill choosen.'); }
# Note: For large cycle lengths gcd(φ(p-1), φ(q-1)) should also be small,...
#+...where φ is Euler's totient function but this is not checked here

# Compute Modulus in Blum Blum Shub
$M = $p*$q;

sub randomizeLabel { # This does the actual randomization
    $min = int($entry1->get_text); $max = int($entry2->get_text); # Boundaries for the desired random range from the input filed of the GUI (included for convenience when modifying the script - not used here)

    # Blum Blum Shub pseudo random number generator
    $rand = ($rand*$rand) % $M;

    # Here you have to extract the bits and shift them in range
    $randout = $rand & (2**6-1); # Change this line. It's an example and extracts the five least significant bits! To extract the ten LSBs use '(2**11-1)' and so on...
    # $randout = ...$min...$max...; # shift it in the right range (not done here)

    $diplabel->set_markup( "<span size=\"$size\">$randout</span>" );
}

Как уже упоминалось, он неполный. Нужно использовать побитовые операторы для извлечения полезных случайных чисел, сдвига и масштабирования их для соответствия между $min и $max. В настоящее время вход для минимума и максимума не используется.

36
ответ дан 2 August 2018 в 03:25

ObsessiveFOSS попросил реализовать криптографически защищенный генератор псевдослучайных чисел Blum и др. . Вот мой эскиз о том, как это сделать. Другой код остается таким же, как в предыдущем ответе . Нужно просто заменить подпрограмму randomizeLabel и вставить этот код:

use bigint;

# Kinda large primes
$p = 338047573;   # Any pair of large primes will suffice here...
$q = 4182249941;  #+...as long as they fullfill the congruence check below
$rand = 7;    # Seed for the random number generator (x_0 in the wiki)

sub errMsg {
    $dialog = Gtk2::MessageDialog->new($window, 'destroy-with-parent', 'error', 'ok', $_[0]);
    $dialog->signal_connect (response => sub { exit 1; });
    $dialog->run;
}

# Check congruence 3 mod 4 (for quadratic residue)
if( ($p-3)%4 == 0 ) { errMsg('Error: Variable p is ill choosen.'); }
if( ($q-3)%4 == 0 ) { errMsg('Error: Variable q is ill choosen.'); }
# Note: For large cycle lengths gcd(φ(p-1), φ(q-1)) should also be small,...
#+...where φ is Euler's totient function but this is not checked here

# Compute Modulus in Blum Blum Shub
$M = $p*$q;

sub randomizeLabel { # This does the actual randomization
    $min = int($entry1->get_text); $max = int($entry2->get_text); # Boundaries for the desired random range from the input filed of the GUI (included for convenience when modifying the script - not used here)

    # Blum Blum Shub pseudo random number generator
    $rand = ($rand*$rand) % $M;

    # Here you have to extract the bits and shift them in range
    $randout = $rand & (2**6-1); # Change this line. It's an example and extracts the five least significant bits! To extract the ten LSBs use '(2**11-1)' and so on...
    # $randout = ...$min...$max...; # shift it in the right range (not done here)

    $diplabel->set_markup( "<span size=\"$size\">$randout</span>" );
}

Как уже упоминалось, он неполный. Нужно использовать побитовые операторы для извлечения полезных случайных чисел, сдвига и масштабирования их для соответствия между $min и $max. В настоящее время вход для минимума и максимума не используется.

36
ответ дан 4 August 2018 в 19:22

ObsessiveFOSS попросил реализовать криптографически защищенный генератор псевдослучайных чисел Blum и др. . Вот мой эскиз о том, как это сделать. Другой код остается таким же, как в предыдущем ответе . Нужно просто заменить подпрограмму randomizeLabel и вставить этот код:

use bigint;

# Kinda large primes
$p = 338047573;   # Any pair of large primes will suffice here...
$q = 4182249941;  #+...as long as they fullfill the congruence check below
$rand = 7;    # Seed for the random number generator (x_0 in the wiki)

sub errMsg {
    $dialog = Gtk2::MessageDialog->new($window, 'destroy-with-parent', 'error', 'ok', $_[0]);
    $dialog->signal_connect (response => sub { exit 1; });
    $dialog->run;
}

# Check congruence 3 mod 4 (for quadratic residue)
if( ($p-3)%4 == 0 ) { errMsg('Error: Variable p is ill choosen.'); }
if( ($q-3)%4 == 0 ) { errMsg('Error: Variable q is ill choosen.'); }
# Note: For large cycle lengths gcd(φ(p-1), φ(q-1)) should also be small,...
#+...where φ is Euler's totient function but this is not checked here

# Compute Modulus in Blum Blum Shub
$M = $p*$q;

sub randomizeLabel { # This does the actual randomization
    $min = int($entry1->get_text); $max = int($entry2->get_text); # Boundaries for the desired random range from the input filed of the GUI (included for convenience when modifying the script - not used here)

    # Blum Blum Shub pseudo random number generator
    $rand = ($rand*$rand) % $M;

    # Here you have to extract the bits and shift them in range
    $randout = $rand & (2**6-1); # Change this line. It's an example and extracts the five least significant bits! To extract the ten LSBs use '(2**11-1)' and so on...
    # $randout = ...$min...$max...; # shift it in the right range (not done here)

    $diplabel->set_markup( "<span size=\"$size\">$randout</span>" );
}

Как уже упоминалось, он неполный. Нужно использовать побитовые операторы для извлечения полезных случайных чисел, сдвига и масштабирования их для соответствия между $min и $max. В настоящее время вход для минимума и максимума не используется.

36
ответ дан 6 August 2018 в 03:33

ObsessiveFOSS попросил реализовать криптографически защищенный генератор псевдослучайных чисел Blum и др. . Вот мой эскиз о том, как это сделать. Другой код остается таким же, как в предыдущем ответе . Нужно просто заменить подпрограмму randomizeLabel и вставить этот код:

use bigint;

# Kinda large primes
$p = 338047573;   # Any pair of large primes will suffice here...
$q = 4182249941;  #+...as long as they fullfill the congruence check below
$rand = 7;    # Seed for the random number generator (x_0 in the wiki)

sub errMsg {
    $dialog = Gtk2::MessageDialog->new($window, 'destroy-with-parent', 'error', 'ok', $_[0]);
    $dialog->signal_connect (response => sub { exit 1; });
    $dialog->run;
}

# Check congruence 3 mod 4 (for quadratic residue)
if( ($p-3)%4 == 0 ) { errMsg('Error: Variable p is ill choosen.'); }
if( ($q-3)%4 == 0 ) { errMsg('Error: Variable q is ill choosen.'); }
# Note: For large cycle lengths gcd(φ(p-1), φ(q-1)) should also be small,...
#+...where φ is Euler's totient function but this is not checked here

# Compute Modulus in Blum Blum Shub
$M = $p*$q;

sub randomizeLabel { # This does the actual randomization
    $min = int($entry1->get_text); $max = int($entry2->get_text); # Boundaries for the desired random range from the input filed of the GUI (included for convenience when modifying the script - not used here)

    # Blum Blum Shub pseudo random number generator
    $rand = ($rand*$rand) % $M;

    # Here you have to extract the bits and shift them in range
    $randout = $rand & (2**6-1); # Change this line. It's an example and extracts the five least significant bits! To extract the ten LSBs use '(2**11-1)' and so on...
    # $randout = ...$min...$max...; # shift it in the right range (not done here)

    $diplabel->set_markup( "<span size=\"$size\">$randout</span>" );
}

Как уже упоминалось, он неполный. Нужно использовать побитовые операторы для извлечения полезных случайных чисел, сдвига и масштабирования их для соответствия между $min и $max. В настоящее время вход для минимума и максимума не используется.

36
ответ дан 7 August 2018 в 21:22

ObsessiveFOSS попросил реализовать криптографически защищенный генератор псевдослучайных чисел Blum и др. . Вот мой эскиз о том, как это сделать. Другой код остается таким же, как в предыдущем ответе . Нужно просто заменить подпрограмму randomizeLabel и вставить этот код:

use bigint;

# Kinda large primes
$p = 338047573;   # Any pair of large primes will suffice here...
$q = 4182249941;  #+...as long as they fullfill the congruence check below
$rand = 7;    # Seed for the random number generator (x_0 in the wiki)

sub errMsg {
    $dialog = Gtk2::MessageDialog->new($window, 'destroy-with-parent', 'error', 'ok', $_[0]);
    $dialog->signal_connect (response => sub { exit 1; });
    $dialog->run;
}

# Check congruence 3 mod 4 (for quadratic residue)
if( ($p-3)%4 == 0 ) { errMsg('Error: Variable p is ill choosen.'); }
if( ($q-3)%4 == 0 ) { errMsg('Error: Variable q is ill choosen.'); }
# Note: For large cycle lengths gcd(φ(p-1), φ(q-1)) should also be small,...
#+...where φ is Euler's totient function but this is not checked here

# Compute Modulus in Blum Blum Shub
$M = $p*$q;

sub randomizeLabel { # This does the actual randomization
    $min = int($entry1->get_text); $max = int($entry2->get_text); # Boundaries for the desired random range from the input filed of the GUI (included for convenience when modifying the script - not used here)

    # Blum Blum Shub pseudo random number generator
    $rand = ($rand*$rand) % $M;

    # Here you have to extract the bits and shift them in range
    $randout = $rand & (2**6-1); # Change this line. It's an example and extracts the five least significant bits! To extract the ten LSBs use '(2**11-1)' and so on...
    # $randout = ...$min...$max...; # shift it in the right range (not done here)

    $diplabel->set_markup( "<span size=\"$size\">$randout</span>" );
}

Как уже упоминалось, он неполный. Нужно использовать побитовые операторы для извлечения полезных случайных чисел, сдвига и масштабирования их для соответствия между $min и $max. В настоящее время вход для минимума и максимума не используется.

36
ответ дан 10 August 2018 в 09:40

ObsessiveFOSS попросил реализовать криптографически защищенный генератор псевдослучайных чисел Blum и др. . Вот мой эскиз о том, как это сделать. Другой код остается таким же, как в предыдущем ответе . Нужно просто заменить подпрограмму randomizeLabel и вставить этот код:

use bigint;

# Kinda large primes
$p = 338047573;   # Any pair of large primes will suffice here...
$q = 4182249941;  #+...as long as they fullfill the congruence check below
$rand = 7;    # Seed for the random number generator (x_0 in the wiki)

sub errMsg {
    $dialog = Gtk2::MessageDialog->new($window, 'destroy-with-parent', 'error', 'ok', $_[0]);
    $dialog->signal_connect (response => sub { exit 1; });
    $dialog->run;
}

# Check congruence 3 mod 4 (for quadratic residue)
if( ($p-3)%4 == 0 ) { errMsg('Error: Variable p is ill choosen.'); }
if( ($q-3)%4 == 0 ) { errMsg('Error: Variable q is ill choosen.'); }
# Note: For large cycle lengths gcd(φ(p-1), φ(q-1)) should also be small,...
#+...where φ is Euler's totient function but this is not checked here

# Compute Modulus in Blum Blum Shub
$M = $p*$q;

sub randomizeLabel { # This does the actual randomization
    $min = int($entry1->get_text); $max = int($entry2->get_text); # Boundaries for the desired random range from the input filed of the GUI (included for convenience when modifying the script - not used here)

    # Blum Blum Shub pseudo random number generator
    $rand = ($rand*$rand) % $M;

    # Here you have to extract the bits and shift them in range
    $randout = $rand & (2**6-1); # Change this line. It's an example and extracts the five least significant bits! To extract the ten LSBs use '(2**11-1)' and so on...
    # $randout = ...$min...$max...; # shift it in the right range (not done here)

    $diplabel->set_markup( "<span size=\"$size\">$randout</span>" );
}

Как уже упоминалось, он неполный. Нужно использовать побитовые операторы для извлечения полезных случайных чисел, сдвига и масштабирования их для соответствия между $min и $max. В настоящее время вход для минимума и максимума не используется.

36
ответ дан 13 August 2018 в 15:52
  • 1
    +1 - тот факт, что вы достаточно заботились, чтобы написать сценарий для этого, это потрясающе. – jrg♦ 30 May 2011 в 01:33
  • 2
    Приятно видеть, что вы потратили время на предоставление сценария для этого. Большой! – samarasa 30 May 2011 в 11:47
  • 3
    Рад, что вам это нравится. – con-f-use 30 May 2011 в 13:55
  • 4
    @ con-f-use было бы неплохо, если бы вы могли выпустить его в лицензии gpl. – Lincity 1 June 2011 в 16:28
  • 5
    @Alaukik Будет ли лицензия MIT в порядке с вами. Это более разрешительный и совместимый с GPL? – con-f-use 1 June 2011 в 16:44
  • 6
    Я подозреваю, что для CSPRNG есть модуль Perl, который лучше работает, чем мой скрипт. – con-f-use 30 August 2012 в 20:43

Я не знаю никакого программного обеспечения. Google тоже ничего не придумал. Угадайте, что это слишком простая проблема. Это должно быть около 30 строк кода, если вы написали его на языке сценариев. Вы также можете создать таблицу LibreOffice, чтобы сделать это. Не должно быть ужасно сложно.

Редактировать 1:

pseudo-random number generator - perl gui script [/g4]

Ниже приведен быстрый и грязный Perl-скрипт, который я закодировал. Вы должны иметь возможность изменить его самостоятельно. Когда вы запустите его с помощью perl nameOfTheScript.pl или сделайте его исполняемым с помощью chmod u+x nameOfTheScript.pl, а затем дважды щелкните по нему, это будет выглядеть на рисунке выше.

#!/usr/bin/perl
# © 2011 con-f-use@gmx.net. Use permitted under MIT license: http://www.opensource.org/licenses/mit-license.php
use Gtk2 '-init'; # relies on the gnome toolkit bindings for perl

$size = 1e5;   # fontsize in 0.001 pt (only god knows why)

sub randomizeLabel {   #### this does the actual randomisation
    $min = int($entry1->get_text);
    $max = int($entry2->get_text);
    $rand = int(rand($max-$min+1)) + $min;
    $diplabel->set_markup( "<span size=\"$size\">$rand</span>" );
}
#### the rest is gui stuff:
$window = Gtk2::Window->new('toplevel');
$window->set_title('Random Integer Generator');
$window->signal_connect(destroy => sub { Gtk2->main_quit; });
$window->signal_connect(delete_event => sub { Gtk2->main_quit; });
$window->set_border_width(10);
$vbox = Gtk2::VBox->new(0, 5);   $window->add($vbox); $vbox->show;

$diplabel = Gtk2::Label->new;
$diplabel->set_markup("<span size=\"$size\">0</span>");
$vbox->add($diplabel);          $diplabel->show;

$entry1 = Gtk2::Entry->new;     $vbox->add($entry1);    $entry1->show;
$entry2 = Gtk2::Entry->new;     $vbox->add($entry2);    $entry2->show;

$button = Gtk2::Button->new("Generate!");
$button->signal_connect(clicked => \&randomizeLabel, $window);
$vbox->add($button);            $button->show;

$window->show;    Gtk2->main;
exit 0;

Edit2

ObsessiveFOSS попросил меня включить другой генератор для случайных чисел (так как этот сценарий использует встроенный Perl). Вы можете увидеть эскиз о том, как это сделать в другом ответе .

36
ответ дан 15 August 2018 в 22:42
  • 1
    +1 - тот факт, что вы достаточно заботились, чтобы написать сценарий для этого, это потрясающе. – jrg♦ 30 May 2011 в 01:33
  • 2
    Приятно видеть, что вы потратили время на предоставление сценария для этого. Большой! – samarasa 30 May 2011 в 11:47
  • 3
    Рад, что вам это нравится. – con-f-use 30 May 2011 в 13:55
  • 4
    @ con-f-use было бы неплохо, если бы вы могли выпустить его в лицензии gpl. – Lincity 1 June 2011 в 16:28
  • 5
    @Alaukik Будет ли лицензия MIT в порядке с вами. Это более разрешительный и совместимый с GPL? – con-f-use 1 June 2011 в 16:44

Это можно сделать очень легко с QML сегодня:

import QtQuick 2.0
import Ubuntu.Components 0.1

Rectangle {
    id: mainView
    width: units.gu(30) 
    height: units.gu(40)
    Column {
        id: generator
        spacing: units.gu(1)
        anchors.horizontalCenter: mainView.horizontalCenter
        Text {
            id: ramdom_number
            text: "0"
            font.pointSize: 100
            anchors.horizontalCenter: generator.horizontalCenter
        }
        TextField {
            id:min
            text: "0"
        }
        TextField {
            id: max
            text: "100"
        }
        Button {
            text: "Generate!"
            width: generator.width
            onClicked: ramdom_number.text = Math.floor((Math.random()*(max.text-min.text+1))+min.text);
        }
    }
}

Запустить этот код с помощью qmlscene:

enter image description here [/g0]

1
ответ дан 25 July 2018 в 21:49

Это можно сделать очень легко с QML сегодня:

import QtQuick 2.0
import Ubuntu.Components 0.1

Rectangle {
    id: mainView
    width: units.gu(30) 
    height: units.gu(40)
    Column {
        id: generator
        spacing: units.gu(1)
        anchors.horizontalCenter: mainView.horizontalCenter
        Text {
            id: ramdom_number
            text: "0"
            font.pointSize: 100
            anchors.horizontalCenter: generator.horizontalCenter
        }
        TextField {
            id:min
            text: "0"
        }
        TextField {
            id: max
            text: "100"
        }
        Button {
            text: "Generate!"
            width: generator.width
            onClicked: ramdom_number.text = Math.floor((Math.random()*(max.text-min.text+1))+min.text);
        }
    }
}

Запустить этот код с помощью qmlscene:

enter image description here [/g0]

1
ответ дан 26 July 2018 в 17:01

Это можно сделать очень легко с QML сегодня:

import QtQuick 2.0
import Ubuntu.Components 0.1

Rectangle {
    id: mainView
    width: units.gu(30) 
    height: units.gu(40)
    Column {
        id: generator
        spacing: units.gu(1)
        anchors.horizontalCenter: mainView.horizontalCenter
        Text {
            id: ramdom_number
            text: "0"
            font.pointSize: 100
            anchors.horizontalCenter: generator.horizontalCenter
        }
        TextField {
            id:min
            text: "0"
        }
        TextField {
            id: max
            text: "100"
        }
        Button {
            text: "Generate!"
            width: generator.width
            onClicked: ramdom_number.text = Math.floor((Math.random()*(max.text-min.text+1))+min.text);
        }
    }
}

Запустить этот код с помощью qmlscene:

enter image description here [/g0]

1
ответ дан 31 July 2018 в 11:53

Это можно сделать очень легко с QML сегодня:

import QtQuick 2.0
import Ubuntu.Components 0.1

Rectangle {
    id: mainView
    width: units.gu(30) 
    height: units.gu(40)
    Column {
        id: generator
        spacing: units.gu(1)
        anchors.horizontalCenter: mainView.horizontalCenter
        Text {
            id: ramdom_number
            text: "0"
            font.pointSize: 100
            anchors.horizontalCenter: generator.horizontalCenter
        }
        TextField {
            id:min
            text: "0"
        }
        TextField {
            id: max
            text: "100"
        }
        Button {
            text: "Generate!"
            width: generator.width
            onClicked: ramdom_number.text = Math.floor((Math.random()*(max.text-min.text+1))+min.text);
        }
    }
}

Запустить этот код с помощью qmlscene:

enter image description here [/g0]

1
ответ дан 2 August 2018 в 03:25

Это можно сделать очень легко с QML сегодня:

import QtQuick 2.0
import Ubuntu.Components 0.1

Rectangle {
    id: mainView
    width: units.gu(30) 
    height: units.gu(40)
    Column {
        id: generator
        spacing: units.gu(1)
        anchors.horizontalCenter: mainView.horizontalCenter
        Text {
            id: ramdom_number
            text: "0"
            font.pointSize: 100
            anchors.horizontalCenter: generator.horizontalCenter
        }
        TextField {
            id:min
            text: "0"
        }
        TextField {
            id: max
            text: "100"
        }
        Button {
            text: "Generate!"
            width: generator.width
            onClicked: ramdom_number.text = Math.floor((Math.random()*(max.text-min.text+1))+min.text);
        }
    }
}

Запустить этот код с помощью qmlscene:

enter image description here [/g0]

1
ответ дан 4 August 2018 в 19:22

Это можно сделать очень легко с QML сегодня:

import QtQuick 2.0
import Ubuntu.Components 0.1

Rectangle {
    id: mainView
    width: units.gu(30) 
    height: units.gu(40)
    Column {
        id: generator
        spacing: units.gu(1)
        anchors.horizontalCenter: mainView.horizontalCenter
        Text {
            id: ramdom_number
            text: "0"
            font.pointSize: 100
            anchors.horizontalCenter: generator.horizontalCenter
        }
        TextField {
            id:min
            text: "0"
        }
        TextField {
            id: max
            text: "100"
        }
        Button {
            text: "Generate!"
            width: generator.width
            onClicked: ramdom_number.text = Math.floor((Math.random()*(max.text-min.text+1))+min.text);
        }
    }
}

Запустить этот код с помощью qmlscene:

enter image description here [/g0]

1
ответ дан 6 August 2018 в 03:33

Это можно сделать очень легко с QML сегодня:

import QtQuick 2.0
import Ubuntu.Components 0.1

Rectangle {
    id: mainView
    width: units.gu(30) 
    height: units.gu(40)
    Column {
        id: generator
        spacing: units.gu(1)
        anchors.horizontalCenter: mainView.horizontalCenter
        Text {
            id: ramdom_number
            text: "0"
            font.pointSize: 100
            anchors.horizontalCenter: generator.horizontalCenter
        }
        TextField {
            id:min
            text: "0"
        }
        TextField {
            id: max
            text: "100"
        }
        Button {
            text: "Generate!"
            width: generator.width
            onClicked: ramdom_number.text = Math.floor((Math.random()*(max.text-min.text+1))+min.text);
        }
    }
}

Запустить этот код с помощью qmlscene:

enter image description here [/g0]

1
ответ дан 7 August 2018 в 21:22

Это можно сделать очень легко с QML сегодня:

import QtQuick 2.0
import Ubuntu.Components 0.1

Rectangle {
    id: mainView
    width: units.gu(30) 
    height: units.gu(40)
    Column {
        id: generator
        spacing: units.gu(1)
        anchors.horizontalCenter: mainView.horizontalCenter
        Text {
            id: ramdom_number
            text: "0"
            font.pointSize: 100
            anchors.horizontalCenter: generator.horizontalCenter
        }
        TextField {
            id:min
            text: "0"
        }
        TextField {
            id: max
            text: "100"
        }
        Button {
            text: "Generate!"
            width: generator.width
            onClicked: ramdom_number.text = Math.floor((Math.random()*(max.text-min.text+1))+min.text);
        }
    }
}

Запустить этот код с помощью qmlscene:

enter image description here [/g0]

1
ответ дан 10 August 2018 в 09:40

Это можно сделать очень легко с QML сегодня:

import QtQuick 2.0
import Ubuntu.Components 0.1

Rectangle {
    id: mainView
    width: units.gu(30) 
    height: units.gu(40)
    Column {
        id: generator
        spacing: units.gu(1)
        anchors.horizontalCenter: mainView.horizontalCenter
        Text {
            id: ramdom_number
            text: "0"
            font.pointSize: 100
            anchors.horizontalCenter: generator.horizontalCenter
        }
        TextField {
            id:min
            text: "0"
        }
        TextField {
            id: max
            text: "100"
        }
        Button {
            text: "Generate!"
            width: generator.width
            onClicked: ramdom_number.text = Math.floor((Math.random()*(max.text-min.text+1))+min.text);
        }
    }
}

Запустить этот код с помощью qmlscene:

enter image description here [/g0]

1
ответ дан 13 August 2018 в 15:52

Другие вопросы по тегам:

Похожие вопросы: