Софт Исходник Random words generator

Начинающий
Статус
Оффлайн
Регистрация
22 Окт 2022
Сообщения
98
Реакции[?]
24
Поинты[?]
0
1.2. Запрещено выделять всё сообщение жирным шрифтом, курсивом, подчеркиванием, цветом. Пользуйтесь BB-кодами с умом, выделяя лишь самое важное в теме, на что следует обратить внимание.
Что это? / What this?
Ru: Это софт который может случайным образом сгенерировать слова которые указаны в файле words или без него(не понимаю для чего делали),хуета написанная на C++
Eng: This is software that can randomly generate words that are specified in the words file or without it (I don't understand why they did it), the fuck is written in C++

Инструкция / Instruction
Ru: Разархивируйте или скомпилируйте софт, создайте файл words.txt (может работать и без него но генерит полный пиздец)
Eng: Unzip the archive or compile the software create a file words.txt (it can work without it, but it will be completely fucked up)

Download and VT
Пожалуйста, авторизуйтесь для просмотра ссылки.
- (нн антивирусы жалуются)
rat.
Пожалуйста, авторизуйтесь для просмотра ссылки.

backdoor.
Пожалуйста, авторизуйтесь для просмотра ссылки.

Пожалуйста, авторизуйтесь для просмотра ссылки.
credits: llama
 
feel irl
Участник
Статус
Оффлайн
Регистрация
21 Дек 2018
Сообщения
677
Реакции[?]
294
Поинты[?]
16K
Searching for myself
Пользователь
Статус
Оффлайн
Регистрация
29 Сен 2021
Сообщения
212
Реакции[?]
69
Поинты[?]
11K
Я согласен, но это ctrl+c ctrl+v из какого-то старого проекта
Не знаю зачем но я это написал, не тестировал, но на godbolt работает
Bad code!:
#include <fstream>
#include <iostream>
#include <random>
#include <vector>

// Define the file name
constexpr std::string_view svFileName { "Words.txt" };

// Check if the file name is empty (compile time)
static_assert( !svFileName.empty( ), "The file name cannot be empty!" );

template < class TValueType = std::uint32_t >
    requires std::integral< TValueType >
[[nodiscard]] constexpr TValueType GetRandomNumber( const TValueType &rMin, const TValueType &rMax ) noexcept {
    // Create a random engine
    std::mt19937_64 mtEngine { std::random_device { }( ) };

    // Create a uniform distribution between rMin and rMax
    std::uniform_int_distribution< TValueType > uidDistribution { rMin, rMax };

    // Return the random number
    return uidDistribution( mtEngine );
}

int main( ) try {
    // Open the file for reading
    std::ifstream ifsFile { svFileName.data( ), std::ios::in };

    // Check if the file is open
    if ( !ifsFile.is_open( ) )
        throw std::runtime_error { "The file cannot be opened!" };

    // Create a vector of words
    std::vector< std::string_view > vecWords { };

    // Read the words from the file
    for ( std::string strWord { }; std::getline( ifsFile, strWord ); )
        vecWords.emplace_back( strWord.data( ) );

    // Check if the vector is empty
    if ( vecWords.empty( ) )
        throw std::runtime_error { "The vector cannot be empty!" };

    // Get a random number
    const auto iRandomNumber { GetRandomNumber< std::uint32_t >( 0, vecWords.size( ) - 1 ) };

    // Print the random word
    std::cout << "Random word: " << vecWords.at( iRandomNumber ) << "\n";

    // Wait for the user to press a key (so that stop console)
    std::cin.get( );

    // Return false to indicate that the program ended successfully
    return 0;
} catch ( const std::exception &rException ) {
    // Print the exception message
    std::cout << "Exception: " << rException.what( ) << "\n";

    // Wait for the user to press a key (so that stop console)
    std::cin.get( );

    // Return true to indicate that the program ended with an error
    return 1;
}
 
Последнее редактирование:
Легенда форума
Статус
Оффлайн
Регистрация
10 Дек 2018
Сообщения
4,339
Реакции[?]
2,261
Поинты[?]
165K
Оно просто берёт из списка рандомное слово и выводит в консоль? Тогда почему генератор? Чево...
 
Участник
Статус
Оффлайн
Регистрация
13 Ноя 2020
Сообщения
1,230
Реакции[?]
180
Поинты[?]
67K
Оно просто берёт из списка рандомное слово и выводит в консоль? Тогда почему генератор? Чево...
Это генератор говна, каждый кто хочет щитпостить, может просто зайти в эту прогу.
 
Легенда форума
Статус
Оффлайн
Регистрация
10 Дек 2018
Сообщения
4,339
Реакции[?]
2,261
Поинты[?]
165K
Разработчик
Статус
Оффлайн
Регистрация
1 Сен 2018
Сообщения
1,606
Реакции[?]
872
Поинты[?]
113K
Что это? / What this?
Ru: Это софт который может случайным образом сгенерировать слова которые указаны в файле words или без него(не понимаю для чего делали),хуета написанная на C++
Eng: This is software that can randomly generate words that are specified in the words file or without it (I don't understand why they did it), the fuck is written in C++

Инструкция / Instruction
Ru: Разархивируйте или скомпилируйте софт, создайте файл words.txt (может работать и без него но генерит полный пиздец)
Eng: Unzip the archive or compile the software create a file words.txt (it can work without it, but it will be completely fucked up)

Download and VT
Пожалуйста, авторизуйтесь для просмотра ссылки.
- (нн антивирусы жалуются)
rat.
Пожалуйста, авторизуйтесь для просмотра ссылки.

backdoor.
Пожалуйста, авторизуйтесь для просмотра ссылки.

Пожалуйста, авторизуйтесь для просмотра ссылки.
credits: llama
Можно было бы цепи Маркова прикрутить тогда уже, если это генератор слов ( предложений? )
 
Начинающий
Статус
Оффлайн
Регистрация
22 Окт 2022
Сообщения
98
Реакции[?]
24
Поинты[?]
0
Можно было бы цепи Маркова прикрутить тогда уже, если это генератор слов ( предложений? )
ай донт спик инглиш просто написал как мог ,а уебищный яндекс переводчик помогал
 
купить дизайн: yougame.biz/threads/155999
Дизайнер
Статус
Оффлайн
Регистрация
19 Сен 2018
Сообщения
797
Реакции[?]
1,382
Поинты[?]
9K
Не знаю зачем но я это написал, не тестировал, но на godbolt работает
Bad code!:
#include <fstream>
#include <iostream>
#include <random>
#include <vector>

// Define the file name
constexpr std::string_view svFileName { "Words.txt" };

// Check if the file name is empty (compile time)
static_assert( !svFileName.empty( ), "The file name cannot be empty!" );

template < class TValueType = std::uint32_t >
    requires std::integral< TValueType >
[[nodiscard]] constexpr TValueType GetRandomNumber( const TValueType &rMin, const TValueType &rMax ) noexcept {
    // Create a random engine
    std::mt19937_64 mtEngine { std::random_device { }( ) };

    // Create a uniform distribution between rMin and rMax
    std::uniform_int_distribution< TValueType > uidDistribution { rMin, rMax };

    // Return the random number
    return uidDistribution( mtEngine );
}

int main( ) try {
    // Open the file for reading
    std::ifstream ifsFile { svFileName.data( ), std::ios::in };

    // Check if the file is open
    if ( !ifsFile.is_open( ) )
        throw std::runtime_error { "The file cannot be opened!" };

    // Create a vector of words
    std::vector< std::string_view > vecWords { };

    // Read the words from the file
    for ( std::string strWord { }; std::getline( ifsFile, strWord ); )
        vecWords.emplace_back( strWord.data( ) );

    // Check if the vector is empty
    if ( vecWords.empty( ) )
        throw std::runtime_error { "The vector cannot be empty!" };

    // Get a random number
    const auto iRandomNumber { GetRandomNumber< std::uint32_t >( 0, vecWords.size( ) - 1 ) };

    // Print the random word
    std::cout << "Random word: " << vecWords.at( iRandomNumber ) << "\n";

    // Wait for the user to press a key (so that stop console)
    std::cin.get( );

    // Return false to indicate that the program ended successfully
    return 0;
} catch ( const std::exception &rException ) {
    // Print the exception message
    std::cout << "Exception: " << rException.what( ) << "\n";

    // Wait for the user to press a key (so that stop console)
    std::cin.get( );

    // Return true to indicate that the program ended with an error
    return 1;
}
C++:
#include <fstream>
#include <iostream>
#include <random>
#include <vector>
#include <string>

template < typename _int_t >
// random_int, функция работает лишь для целых чисел
// нет ограничения, uniform_int_distribution и так имеет проверку на тип
constexpr _int_t random_int( const _int_t& min, const _int_t& max ) {
    // default_random_engine потому что не требуется определенная функция
    static std::default_random_engine s_random_engine{ std::random_device{}( ) };

    return std::uniform_int_distribution< _int_t >{ min, max }( s_random_engine );
}

int main( ) {
    std::ifstream file{ "words.txt", std::ios::in };
    if ( !file )
        // эксепшн здесь - название константа, было бы иначе - printf, goto place_path_input
        throw std::runtime_error( "file loading error, try again\n" );

    std::vector< std::string > words{};
    for ( std::string word{}; std::getline( file, word ); )
        words.emplace_back( word );

    if ( words.empty( ) )
        return std::printf( "the file doesn't contain words\n" );

    std::printf( "%s", words[ random_int< std::size_t >( 0, words.size( ) - 1 ) ].data( ) );

    return std::cin.get( );
}
🤐
 
Сверху Снизу